removing periodical function from mootools

This commit is contained in:
Ezequiel Bergamaschi 2014-05-22 00:17:34 -03:00
parent 153cff8205
commit 87b792efdf
3 changed files with 73 additions and 72 deletions

View File

@ -61,8 +61,8 @@ for(var b=0,a=this.length;b<a;b++){var c=typeOf(this[b]);if(c=="null"){continue;
});},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase(); });},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase();
});},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g); });},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g);
return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1); return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);
}return(a[c]!=null)?a[c]:"";});}});Function.implement({bind:function(e){var a=this,b=arguments.length>1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype;g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments); }return(a[c]!=null)?a[c]:"";});}});
return g==e?f:g;};return c;},pass:function(b,c){var a=this;if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b);},periodical:function(c,b,a){return setInterval(this.pass((a==null?[]:a),b),c);}}); Function.implement({bind:function(e){var a=this,b=arguments.length>1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype;g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments);return g==e?f:g;};return c;},pass:function(b,c){var a=this;if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b);},});
Number.alias("each","times");(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat(Array.from(arguments))); Number.alias("each","times");(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat(Array.from(arguments)));
};}});Number.implement(a);})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h}; };}});Number.implement(a);})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h};
}var g=function(){e(this);if(g.$prototyping){return this;}this.$caller=null;var i=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null; }var g=function(){e(this);if(g.$prototyping){return this;}this.$caller=null;var i=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null;
@ -73,5 +73,4 @@ break;}}return g;};var b=function(g,h,j){if(j.$origin){j=j.$origin;}var i=functi
}var l=this.caller,m=this.$caller;this.caller=m;this.$caller=i;var k=j.apply(this,arguments);this.$caller=m;this.caller=l;return k;}.extend({$owner:g,$origin:j,$name:h}); }var l=this.caller,m=this.$caller;this.caller=m;this.$caller=i;var k=j.apply(this,arguments);this.$caller=m;this.caller=l;return k;}.extend({$owner:g,$origin:j,$name:h});
return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this; return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this;
}this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping; }this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping;
return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j; return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j;for(var i in h){f.call(this,i,h[i],true);}},this);}};})();
for(var i in h){f.call(this,i,h[i],true);}},this);}};})();

View File

@ -222,11 +222,13 @@ mindplot.widget.Menu = new Class({
}); });
this._registerTooltip('export', $msg('EXPORT')); this._registerTooltip('export', $msg('EXPORT'));
var me = this;
this._addButton('print', false, false, function () { this._addButton('print', false, false, function () {
this.save(saveElem, designer, false); me.save(saveElem, designer, false);
var baseUrl = window.location.href.substring(0, window.location.href.lastIndexOf("c/maps/")); var baseUrl = window.location.href.substring(0, window.location.href.lastIndexOf("c/maps/"));
window.open(baseUrl + 'c/maps/' + mapId + '/print'); window.open(baseUrl + 'c/maps/' + mapId + '/print');
}.bind(this)); });
this._registerTooltip('print', $msg('PRINT')); this._registerTooltip('print', $msg('PRINT'));
@ -271,7 +273,7 @@ mindplot.widget.Menu = new Class({
redoButton.disable(); redoButton.disable();
} }
}.bind(this)); });
} }
this._addButton('addTopic', true, false, function () { this._addButton('addTopic', true, false, function () {
@ -315,12 +317,12 @@ mindplot.widget.Menu = new Class({
}); });
this._registerTooltip('fontItalic', $msg('FONT_ITALIC'), "meta+I"); this._registerTooltip('fontItalic', $msg('FONT_ITALIC'), "meta+I");
var saveElem = $('#save'); var saveElem = $('#save');
if (saveElem) { if (saveElem) {
this._addButton('save', false, false, function () { this._addButton('save', false, false,
this.save(saveElem, designer, true); function () {
}.bind(this)); me.save(saveElem, designer, true);
});
this._registerTooltip('save', $msg('SAVE'), "meta+S"); this._registerTooltip('save', $msg('SAVE'), "meta+S");
@ -328,26 +330,27 @@ mindplot.widget.Menu = new Class({
// To prevent the user from leaving the page with changes ... // To prevent the user from leaving the page with changes ...
// Element.NativeEvents.unload = 1; // Element.NativeEvents.unload = 1;
$(window).bind('unload', function () { $(window).bind('unload', function () {
if (this.isSaveRequired()) { if (me.isSaveRequired()) {
this.save(saveElem, designer, false, true); me.save(saveElem, designer, false, true);
} }
this.unlockMap(designer); me.unlockMap(designer);
}.bind(this)); });
// Autosave on a fixed period of time ... // Autosave on a fixed period of time ...
(function () { setInterval(
if (this.isSaveRequired()) { function() {
this.save(saveElem, designer, false); if (me.isSaveRequired()) {
me.save(saveElem, designer, false);
} }
}.bind(this)).periodical(30000); }, 30000);
} }
} }
var discardElem = $('#discard'); var discardElem = $('#discard');
if (discardElem) { if (discardElem) {
this._addButton('discard', false, false, function () { this._addButton('discard', false, false, function () {
this.discardChanges(designer); me.discardChanges(designer);
}.bind(this)); });
this._registerTooltip('discard', $msg('DISCARD_CHANGES')); this._registerTooltip('discard', $msg('DISCARD_CHANGES'));
} }
@ -450,19 +453,19 @@ mindplot.widget.Menu = new Class({
}, },
_registerEvents: function (designer) { _registerEvents: function (designer) {
var me = this;
// Register on close events ... // Register on close events ...
_.each(this._toolbarElems, function (elem) { _.each(this._toolbarElems, function (elem) {
elem.addEvent('show', function () { elem.addEvent('show', function () {
this.clear() me.clear()
}.bind(this)); });
}.bind(this)); });
designer.addEvent('onblur', function () { designer.addEvent('onblur', function () {
var topics = designer.getModel().filterSelectedTopics(); var topics = designer.getModel().filterSelectedTopics();
var rels = designer.getModel().filterSelectedRelationships(); var rels = designer.getModel().filterSelectedRelationships();
_.each(this._toolbarElems, function (button) { _.each(me._toolbarElems, function (button) {
var isTopicAction = button.isTopicAction(); var isTopicAction = button.isTopicAction();
var isRelAction = button.isRelAction(); var isRelAction = button.isRelAction();
@ -474,13 +477,13 @@ mindplot.widget.Menu = new Class({
} }
} }
}) })
}.bind(this)); });
designer.addEvent('onfocus', function () { designer.addEvent('onfocus', function () {
var topics = designer.getModel().filterSelectedTopics(); var topics = designer.getModel().filterSelectedTopics();
var rels = designer.getModel().filterSelectedRelationships(); var rels = designer.getModel().filterSelectedRelationships();
_.each(this._toolbarElems, function (button) { _.each(me._toolbarElems, function (button) {
var isTopicAction = button.isTopicAction(); var isTopicAction = button.isTopicAction();
var isRelAction = button.isRelAction(); var isRelAction = button.isRelAction();
@ -495,7 +498,7 @@ mindplot.widget.Menu = new Class({
} }
} }
}) })
}.bind(this)); });
}, },
_addButton: function (buttonId, topic, rel, fn) { _addButton: function (buttonId, topic, rel, fn) {
@ -505,8 +508,8 @@ mindplot.widget.Menu = new Class({
var button = new mindplot.widget.ToolbarItem(buttonId, function (event) { var button = new mindplot.widget.ToolbarItem(buttonId, function (event) {
fn(event); fn(event);
this.clear(); me.clear();
}.bind(this), {topicAction: topic, relAction: rel}); }, {topicAction: topic, relAction: rel});
this._toolbarElems.push(button); this._toolbarElems.push(button);
result = button; result = button;

View File

@ -61,8 +61,8 @@ for(var b=0,a=this.length;b<a;b++){var c=typeOf(this[b]);if(c=="null"){continue;
});},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase(); });},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase();
});},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g); });},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g);
return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1); return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);
}return(a[c]!=null)?a[c]:"";});}});Function.implement({bind:function(e){var a=this,b=arguments.length>1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype;g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments); }return(a[c]!=null)?a[c]:"";});}});
return g==e?f:g;};return c;},pass:function(b,c){var a=this;if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b);},periodical:function(c,b,a){return setInterval(this.pass((a==null?[]:a),b),c);}}); Function.implement({bind:function(e){var a=this,b=arguments.length>1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype;g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments);return g==e?f:g;};return c;},pass:function(b,c){var a=this;if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b);},});
Number.alias("each","times");(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat(Array.from(arguments))); Number.alias("each","times");(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat(Array.from(arguments)));
};}});Number.implement(a);})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h}; };}});Number.implement(a);})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h};
}var g=function(){e(this);if(g.$prototyping){return this;}this.$caller=null;var i=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null; }var g=function(){e(this);if(g.$prototyping){return this;}this.$caller=null;var i=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null;
@ -73,5 +73,4 @@ break;}}return g;};var b=function(g,h,j){if(j.$origin){j=j.$origin;}var i=functi
}var l=this.caller,m=this.$caller;this.caller=m;this.$caller=i;var k=j.apply(this,arguments);this.$caller=m;this.caller=l;return k;}.extend({$owner:g,$origin:j,$name:h}); }var l=this.caller,m=this.$caller;this.caller=m;this.$caller=i;var k=j.apply(this,arguments);this.$caller=m;this.caller=l;return k;}.extend({$owner:g,$origin:j,$name:h});
return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this; return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this;
}this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping; }this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping;
return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j; return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j;for(var i in h){f.call(this,i,h[i],true);}},this);}};})();
for(var i in h){f.call(this,i,h[i],true);}},this);}};})();