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();
});},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[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 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);}});
}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 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.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;
@ -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});
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;
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);}};})();
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);}};})();

View File

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