Skip to content

Commit

Permalink
dock javascript NOBUG Add missing ;s that were causing Eclipse warnings.
Browse files Browse the repository at this point in the history
I thought they were also breaking things in Firefox, but I was wrong about that.
Still, seems worth comitting this code clean-up.
  • Loading branch information
timhunt committed Aug 3, 2010
1 parent 113065d commit edc858d
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions blocks/dock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
*/
Expand Down Expand Up @@ -182,7 +182,7 @@ M.core_dock.init = function(Y) {
runningcount++;
}
}
}
};
})(Y).init();

// Attach the required event listeners
Expand All @@ -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.
*/
Expand Down Expand Up @@ -231,15 +231,15 @@ 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');
this.visible = false;
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);
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -464,7 +464,7 @@ M.core_dock.resizeBlockSpace = function(node) {
bodynode.removeClass(blockregions[i].bodyclass);
}
}
}
};
/**
* Adds a dock item into the dock
* @function
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
*/
Expand All @@ -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
Expand All @@ -533,7 +533,7 @@ M.core_dock.remove_all = function() {
this.remove(i);
}
return true;
}
};
/**
* Hides the active item
*/
Expand All @@ -542,7 +542,7 @@ M.core_dock.hideActive = function() {
if (item) {
item.hide();
}
}
};
/**
* Checks wether the dock should be shown or hidden
*/
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -614,7 +614,7 @@ M.core_dock.resize = function() {
}
this.fire('dock:resizepanelcomplete');
return;
}
};
/**
* Returns the currently active dock item or false
*/
Expand All @@ -625,7 +625,7 @@ M.core_dock.getActiveItem = function() {
}
}
return false;
}
};
/**
* This class represents a generic block
* @class M.core_dock.genericblock
Expand Down Expand Up @@ -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);
}
Expand All @@ -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');
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -802,7 +802,7 @@ M.core_dock.genericblock.prototype = {
this.isdocked = false;
return true;
}
}
};

/**
* This class represents an item in the dock
Expand Down Expand Up @@ -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};
})();
}
};
/**
*
*/
Expand Down Expand Up @@ -922,4 +922,4 @@ M.core_dock.item.prototype = {
this.nodes.dockitem.remove();
this.fire('dockeditem:itemremoved');
}
}
};

0 comments on commit edc858d

Please sign in to comment.