mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
dock javascript NOBUG Add missing ;s that were causing Eclipse warnings.
I thought they were also breaking things in Firefox, but I was wrong about that. Still, seems worth comitting this code clean-up.
This commit is contained in:
parent
113065d2fa
commit
edc858dcce
1 changed files with 40 additions and 40 deletions
|
@ -11,7 +11,7 @@ M.core_dock = {
|
|||
initialised : false, // True once thedock has been initialised
|
||||
delayedevent : null, // Will be an object if there is a delayed event in effect
|
||||
preventevent : null // Will be an eventtype if there is an eventyoe to prevent
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Namespace containing the nodes that relate to the dock
|
||||
* @namespace
|
||||
|
@ -20,7 +20,7 @@ M.core_dock.nodes = {
|
|||
dock : null, // The dock itself
|
||||
body : null, // The body of the page
|
||||
panel : null // The docks panel
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Configuration parameters used during the initialisation and setup
|
||||
* of dock and dock items.
|
||||
|
@ -34,7 +34,7 @@ M.core_dock.cfg = {
|
|||
orientation:'vertical', // vertical || horizontal determines if we change the title
|
||||
spacebeforefirstitem: 10, // Space between the top of the dock and the first item
|
||||
removeallicon: M.util.image_url('t/dock_to_block', 'moodle')
|
||||
}
|
||||
};
|
||||
/**
|
||||
* CSS classes to use with the dock
|
||||
* @namespace
|
||||
|
@ -48,7 +48,7 @@ M.core_dock.css = {
|
|||
dockeditemcontainer:'dockeditem_container',
|
||||
dockedtitle:'dockedtitle', // CSS class added to the item's title in each dock
|
||||
activeitem:'activeitem' // CSS class added to the active item
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Augments the classes as required and processes early bindings
|
||||
*/
|
||||
|
@ -182,7 +182,7 @@ M.core_dock.init = function(Y) {
|
|||
runningcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})(Y).init();
|
||||
|
||||
// Attach the required event listeners
|
||||
|
@ -200,7 +200,7 @@ M.core_dock.init = function(Y) {
|
|||
// Inform everyone the dock has been initialised
|
||||
this.fire('dock:initialised');
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Get the panel docked blocks will be shown in and initialise it if we havn't already.
|
||||
*/
|
||||
|
@ -231,7 +231,7 @@ M.core_dock.getPanel = function() {
|
|||
this.removeClass('dockitempanel_hidden');
|
||||
this.fire('dockpanel:shown');
|
||||
this.fire('dockpanel:visiblechange');
|
||||
}
|
||||
};
|
||||
// Add a hide event
|
||||
dockpanel.hide = function() {
|
||||
this.fire('dockpanel:beforehide');
|
||||
|
@ -239,7 +239,7 @@ M.core_dock.getPanel = function() {
|
|||
this.addClass('dockitempanel_hidden');
|
||||
this.fire('dockpanel:hidden');
|
||||
this.fire('dockpanel:visiblechange');
|
||||
}
|
||||
};
|
||||
// Add a method to set the header content
|
||||
dockpanel.setHeader = function(content) {
|
||||
this.contentHeader.setContent(content);
|
||||
|
@ -248,11 +248,11 @@ M.core_dock.getPanel = function() {
|
|||
this.contentHeader.append(arguments[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// Add a method to set the body content
|
||||
dockpanel.setBody = function(content) {
|
||||
this.contentBody.setContent(content);
|
||||
}
|
||||
};
|
||||
// Add a method to set the top of the panel position
|
||||
dockpanel.setTop = function(newtop) {
|
||||
this.setY(newtop);
|
||||
|
@ -262,7 +262,7 @@ M.core_dock.getPanel = function() {
|
|||
return true;
|
||||
}
|
||||
this.setStyle('top', newtop+'px');
|
||||
}
|
||||
};
|
||||
// Put the dockpanel in the body
|
||||
parent.append(dockpanel);
|
||||
// Return it
|
||||
|
@ -273,7 +273,7 @@ M.core_dock.getPanel = function() {
|
|||
this.fire('dock:panelgenerated');
|
||||
}
|
||||
return this.nodes.panel;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handles a generic event within the dock
|
||||
* @param {Y.Event} e
|
||||
|
@ -319,7 +319,7 @@ M.core_dock.handleEvent = function(e, options) {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* This function delays an event and then fires it providing the cursor if either
|
||||
* within or outside of the original target (options.iscontained=true|false)
|
||||
|
@ -337,7 +337,7 @@ M.core_dock.delayEvent = function(event, options, target) {
|
|||
self.delayedevent.target = e.target;
|
||||
}),
|
||||
timeout : null
|
||||
}
|
||||
};
|
||||
})(self);
|
||||
self.delayedevent.timeout = setTimeout(function(){
|
||||
self.delayedevent.timeout = null;
|
||||
|
@ -347,7 +347,7 @@ M.core_dock.delayEvent = function(event, options, target) {
|
|||
}
|
||||
}, options.delay*1000);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Corrects the orientation of the title, which for the default
|
||||
* dock just means making it vertical
|
||||
|
@ -382,7 +382,7 @@ M.core_dock.fixTitleOrientation = function(item, title, text) {
|
|||
|
||||
if (Y.UA.ie > 7) {
|
||||
// IE8 can flip the text via CSS but not handle SVG
|
||||
title.setContent(text)
|
||||
title.setContent(text);
|
||||
title.setAttribute('style', 'writing-mode: tb-rl; filter: flipV flipH;display:inline;');
|
||||
title.addClass('filterrotate');
|
||||
return title;
|
||||
|
@ -413,14 +413,14 @@ M.core_dock.fixTitleOrientation = function(item, title, text) {
|
|||
svg.setAttribute('width', width);
|
||||
svg.appendChild(txt);
|
||||
|
||||
title.append(svg)
|
||||
title.append(svg);
|
||||
|
||||
item.on('dockeditem:drawcomplete', function(txt, title){
|
||||
txt.setAttribute('fill', Y.one(title).getStyle('color'));
|
||||
}, item, txt, title);
|
||||
|
||||
return title;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Resizes the space that contained blocks if there were no blocks left in
|
||||
* it. e.g. if all blocks have been moved to the dock
|
||||
|
@ -464,7 +464,7 @@ M.core_dock.resizeBlockSpace = function(node) {
|
|||
bodynode.removeClass(blockregions[i].bodyclass);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Adds a dock item into the dock
|
||||
* @function
|
||||
|
@ -478,14 +478,14 @@ M.core_dock.add = function(item) {
|
|||
this.items[item.id].draw();
|
||||
this.fire('dock:itemadded', item);
|
||||
this.fire('dock:itemschanged', item);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Appends a dock item to the dock
|
||||
* @param {YUI.Node} docknode
|
||||
*/
|
||||
M.core_dock.append = function(docknode) {
|
||||
this.nodes.container.append(docknode);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Initialises a generic block object
|
||||
* @param {YUI} Y
|
||||
|
@ -496,7 +496,7 @@ M.core_dock.init_genericblock = function(Y, id) {
|
|||
this.init(Y);
|
||||
}
|
||||
new this.genericblock(id).init(Y, Y.one('#inst'+id));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Removes the node at the given index and puts it back into conventional page sturcture
|
||||
* @function
|
||||
|
@ -513,7 +513,7 @@ M.core_dock.remove = function(uid) {
|
|||
this.fire('dock:itemremoved', uid);
|
||||
this.fire('dock:itemschanged', uid);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Ensures the the first item in the dock has the correct class
|
||||
*/
|
||||
|
@ -522,7 +522,7 @@ M.core_dock.resetFirstItem = function() {
|
|||
if (this.nodes.dock.one('.'+this.css.dockeditem)) {
|
||||
this.nodes.dock.one('.'+this.css.dockeditem).addClass('firstdockitem');
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Removes all nodes and puts them back into conventional page sturcture
|
||||
* @function
|
||||
|
@ -533,7 +533,7 @@ M.core_dock.remove_all = function() {
|
|||
this.remove(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Hides the active item
|
||||
*/
|
||||
|
@ -542,7 +542,7 @@ M.core_dock.hideActive = function() {
|
|||
if (item) {
|
||||
item.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Checks wether the dock should be shown or hidden
|
||||
*/
|
||||
|
@ -557,7 +557,7 @@ M.core_dock.checkDockVisibility = function() {
|
|||
this.nodes.body.addClass(this.css.body);
|
||||
this.fire('dock:shown');
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* This smart little function allows developers to attach event listeners before
|
||||
* the dock has been augmented to allows event listeners.
|
||||
|
@ -569,7 +569,7 @@ M.core_dock.checkDockVisibility = function() {
|
|||
*/
|
||||
M.core_dock.on = function(event, callback) {
|
||||
this.earlybinds.push({event:event,callback:callback});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* This function takes all early binds and attaches them as listeners properly
|
||||
* This should only be called once augmentation is complete.
|
||||
|
@ -580,7 +580,7 @@ M.core_dock.applyBinds = function() {
|
|||
this.on(bind.event, bind.callback);
|
||||
}
|
||||
this.earlybinds = [];
|
||||
}
|
||||
};
|
||||
/**
|
||||
* This function checks the size and position of the panel and moves/resizes if
|
||||
* required to keep it within the bounds of the window.
|
||||
|
@ -614,7 +614,7 @@ M.core_dock.resize = function() {
|
|||
}
|
||||
this.fire('dock:resizepanelcomplete');
|
||||
return;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Returns the currently active dock item or false
|
||||
*/
|
||||
|
@ -625,7 +625,7 @@ M.core_dock.getActiveItem = function() {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* This class represents a generic block
|
||||
* @class M.core_dock.genericblock
|
||||
|
@ -683,7 +683,7 @@ M.core_dock.genericblock.prototype = {
|
|||
|
||||
// Move the block straight to the dock if required
|
||||
if (node.hasClass('dock_on_load')) {
|
||||
node.removeClass('dock_on_load')
|
||||
node.removeClass('dock_on_load');
|
||||
this.skipsetposition = true;
|
||||
this.move_to_dock(null, commands);
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ M.core_dock.genericblock.prototype = {
|
|||
}
|
||||
|
||||
var Y = this.Y;
|
||||
var dock = M.core_dock
|
||||
var dock = M.core_dock;
|
||||
|
||||
var node = Y.one('#inst'+this.id);
|
||||
var blockcontent = node.one('.content');
|
||||
|
@ -746,12 +746,12 @@ M.core_dock.genericblock.prototype = {
|
|||
// check the contents block [editing=off]
|
||||
this.contents.all('.moveto').on('returntoblock|click', function(e){
|
||||
e.halt();
|
||||
dock.remove(this.id)
|
||||
dock.remove(this.id);
|
||||
}, this);
|
||||
// check the commands block [editing=on]
|
||||
this.commands.all('.moveto').on('returntoblock|click', function(e){
|
||||
e.halt();
|
||||
dock.remove(this.id)
|
||||
dock.remove(this.id);
|
||||
}, this);
|
||||
// Add a close icon
|
||||
// Must set the image src seperatly of we get an error with XML strict headers
|
||||
|
@ -802,7 +802,7 @@ M.core_dock.genericblock.prototype = {
|
|||
this.isdocked = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents an item in the dock
|
||||
|
@ -839,12 +839,12 @@ M.core_dock.item = function(Y, uid, title, contents, commands, blockclass){
|
|||
this.commands = commands;
|
||||
}
|
||||
if (blockclass && this.blockclass==null) {
|
||||
this.blockclass = blockclass
|
||||
this.blockclass = blockclass;
|
||||
}
|
||||
this.nodes = (function(){
|
||||
return {docktitle : null, dockitem : null, container: null}
|
||||
return {docktitle : null, dockitem : null, container: null};
|
||||
})();
|
||||
}
|
||||
};
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -922,4 +922,4 @@ M.core_dock.item.prototype = {
|
|||
this.nodes.dockitem.remove();
|
||||
this.fire('dockeditem:itemremoved');
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue