Replace $ by document.id for avoid colitions.

This commit is contained in:
Paulo Gustavo Veiga 2014-02-17 10:16:43 -03:00
parent 8ae2ab8fbf
commit 8e1a4e73be
16 changed files with 47 additions and 47 deletions

View File

@ -83,7 +83,7 @@ mindplot.Designer = new Class({
var screenManager = workspace.getScreenManager();
// Zoom In and Zoom Out must active event
$(document).addEvent('mousewheel', function (event) {
document.id(document).addEvent('mousewheel', function (event) {
// Change mousewheel handling so we let the default
//event happen if we are outside the container.
var coords = screenManager.getContainer().getCoordinates();

View File

@ -193,14 +193,14 @@ mindplot.DesignerKeyboard = new Class({
'ctrl+s':function (event) {
event.preventDefault();
event.stopPropagation();
$('save').fireEvent('click');
document.id('save').fireEvent('click');
},
'meta+s':function (event) {
event.preventDefault();
event.stopPropagation();
$('save').fireEvent('click');
document.id('save').fireEvent('click');
},
'ctrl+i':function (event) {
@ -350,7 +350,7 @@ mindplot.DesignerKeyboard = new Class({
excludes.push("alt");
}
$(document).addEvent('keydown', function (event) {
document.id(document).addEvent('keydown', function (event) {
// Convert key to mootools keyboard event format...
var keys = [];

View File

@ -166,7 +166,7 @@ mindplot.MultilineTextEditor = new Class({
if (!this.isVisible()) {
//Create editor ui
var containerElem = this._buildEditor();
containerElem.inject($(document.body));
containerElem.inject(document.id(document.body));
this._containerElem = containerElem;
this._registerEvents(containerElem);

View File

@ -121,7 +121,7 @@ mindplot.TextEditor = new Class({
if (!this.isVisible()) {
//Create editor ui
var editorElem = this._buildEditor();
editorElem.inject($(document.body));
editorElem.inject(document.id(document.body));
this._containerElem = editorElem;
this._registerEvents(editorElem);

View File

@ -1 +1 @@
$(document).fireEvent('loadcomplete', 'mind');
document.id(document).fireEvent('loadcomplete', 'mind');

View File

@ -137,7 +137,7 @@ mindplot.layout.LayoutManager = new Class({
// Collect changes ...
this._collectChanges();
if (!$(fireEvents) || fireEvents) {
if (!document.id(fireEvents) || fireEvents) {
this._flushEvents();
}

View File

@ -50,12 +50,12 @@ var b=0;for(h=0;h<d.length&&h<c.length&&d[h]==c[h];h++){}for(b=0;b<d.length-h-1;
};var a=Object.prototype.hasOwnProperty;Object.extend({getFromPath:function(e,f){if(typeof f=="string"){f=f.split(".");}for(var d=0,c=f.length;d<c;d++){if(a.call(e,f[d])){e=e[f[d]];
}else{return null;}}return e;},cleanValues:function(c,e){e=e||b;for(var d in c){if(!e(c[d])){delete c[d];}}return c;},erase:function(c,d){if(a.call(c,d)){delete c[d];
}return c;},run:function(d){var c=Array.slice(arguments,1);for(var e in d){if(d[e].apply){d[e].apply(d,c);}}return d;}});})();Hash.implement({getFromPath:function(a){return Object.getFromPath(this,a);
},cleanValues:function(a){return new Hash(Object.cleanValues(this,a));},run:function(){Object.run(arguments);}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);
},cleanValues:function(a){return new Hash(Object.cleanValues(this,a));},run:function(){Object.run(arguments);}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$document.id(b);
this.parent(a);},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j);}}return c;
},set:function(b){for(var c in b){if(!this.elements[c]){continue;}var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit);}}return this;
},start:function(c){if(!this.check(c)){return this;}var h={},j={};for(var d in c){if(!this.elements[d]){continue;}var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);
a[b]=e.from;g[b]=e.to;}}return this.parent(h,j);}});Fx.Accordion=new Class({Extends:Fx.Elements,options:{fixedHeight:false,fixedWidth:false,display:0,show:false,height:true,width:false,opacity:true,alwaysHide:false,trigger:"click",initialDisplayFx:true,resetHeight:true},initialize:function(){var g=function(h){return h!=null;
};var f=Array.link(arguments,{container:Type.isElement,options:Type.isObject,togglers:g,elements:g});this.parent(f.elements,f.options);var b=this.options,e=this.togglers=$$(f.togglers);
};var f=Array.link(arguments,{container:Type.isElement,options:Type.isObject,togglers:g,elements:g});this.parent(f.elements,f.options);var b=this.options,e=this.togglers=$document.id(f.togglers);
this.previous=-1;this.internalChain=new Chain();if(b.alwaysHide){this.options.link="chain";}if(b.show||this.options.show===0){b.display=false;this.previous=b.show;
}if(b.start){b.display=false;b.show=false;}var d=this.effects={};if(b.opacity){d.opacity="fullOpacity";}if(b.width){d.width=b.fixedWidth?"fullWidth":"offsetWidth";
}if(b.height){d.height=b.fixedHeight?"fullHeight":"scrollHeight";}for(var c=0,a=e.length;c<a;c++){this.addSection(e[c],this.elements[c]);}this.elements.each(function(j,h){if(b.show===h){this.fireEvent("active",[e[h],j]);
@ -160,7 +160,7 @@ this.open=true;return this.set([0,this.offset]);},toggle:function(a){return this
return this;},get:function(){var a=this.retrieve("slide");if(!a){a=new Fx.Slide(this,{link:"cancel"});this.store("slide",a);}return a;}};Element.implement({slide:function(d,e){d=d||"toggle";
var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[c?"slideOut":"slideIn"](e);
this.store("slide:flag",!c);a=true;break;default:b.start(d,e);}if(!a){this.eliminate("slide:flag");}return this;}});Fx.SmoothScroll=new Class({Extends:Fx.Scroll,options:{axes:["x","y"]},initialize:function(c,d){d=d||document;
this.doc=d.getDocument();this.parent(this.doc,c);var e=d.getWindow(),a=e.location.href.match(/^[^#]*/)[0]+"#",b=$$(this.options.links||this.doc.links);
this.doc=d.getDocument();this.parent(this.doc,c);var e=d.getWindow(),a=e.location.href.match(/^[^#]*/)[0]+"#",b=$document.id(this.options.links||this.doc.links);
b.each(function(g){if(g.href.indexOf(a)!=0){return;}var f=g.href.substr(a.length);if(f){this.useLink(g,f);}},this);this.addEvent("complete",function(){e.location.hash=this.anchor;
this.element.scrollTo(this.to[0],this.to[1]);},true);},useLink:function(b,a){b.addEvent("click",function(d){var c=document.id(a)||this.doc.getElement("a[name="+a+"]");
if(!c){return;}d.preventDefault();this.toElement(c,this.options.axes).chain(function(){this.fireEvent("scrolledTo",[b,c]);}.bind(this));this.anchor=a;}.bind(this));
@ -173,12 +173,12 @@ if(e.length!=this.elements.length){this.currentOrder.each(function(j){if(!e.cont
}}var b=0;i=a=0;e.each(function(k){var j={};if(d){j.top=i-f[k].top-b;i+=f[k].height;}else{j.left=a-f[k].left;a+=f[k].width;}b=b+f[k].margin;c[k]=j;},this);
var g={};Array.clone(e).sort().each(function(j){g[j]=c[j];});this.start(g);this.currentOrder=e;return this;},rearrangeDOM:function(a){a=a||this.currentOrder;
var b=this.elements[0].getParent();var c=[];this.elements.setStyle("opacity",0);a.each(function(d){c.push(this.elements[d].inject(b).setStyles({top:0,left:0}));
},this);this.elements.setStyle("opacity",1);this.elements=$$(c);this.setDefaultOrder();return this;},getDefaultOrder:function(){return this.elements.map(function(b,a){return a;
},this);this.elements.setStyle("opacity",1);this.elements=$document.id(c);this.setDefaultOrder();return this;},getDefaultOrder:function(){return this.elements.map(function(b,a){return a;
});},getCurrentOrder:function(){return this.currentOrder;},forward:function(){return this.sort(this.getDefaultOrder());},backward:function(){return this.sort(this.getDefaultOrder().reverse());
},reverse:function(){return this.sort(this.currentOrder.reverse());},sortByElements:function(a){return this.sort(a.map(function(b){return this.elements.indexOf(b);
},this));},swap:function(c,b){if(typeOf(c)=="element"){c=this.elements.indexOf(c);}if(typeOf(b)=="element"){b=this.elements.indexOf(b);}var a=Array.clone(this.currentOrder);
a[this.currentOrder.indexOf(c)]=b;a[this.currentOrder.indexOf(b)]=c;return this.sort(a);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,element:function(c){return c!=null;
}});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=typeOf(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;
}});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=typeOf(this.options.handle);this.handles=((a=="array"||a=="collection")?$document.id(this.options.handle):document.id(this.options.handle))||this.element;
this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.ie)?"selectstart":"mousedown";if(Browser.ie&&!Drag.ondragstartFixed){document.ondragstart=Function.from(false);
Drag.ondragstartFixed=true;}this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:Function.from(false)};
this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);
@ -197,7 +197,7 @@ this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);}},drag:
if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(b){var a={mousemove:this.bound.drag,mouseup:this.bound.stop};
a[this.selection]=this.bound.eventStop;this.document.removeEvents(a);if(b){this.fireEvent("complete",[this.element,b]);}}});Element.implement({makeResizable:function(a){var b=new Drag(this,Object.merge({modifiers:{x:"width",y:"height"}},a));
this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);}.bind(this));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(b,a){this.parent(b,a);
b=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&typeOf(this.container)!="element"){this.container=document.id(this.container.getDocument().body);
b=this.element;this.droppables=$document.id(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&typeOf(this.container)!="element"){this.container=document.id(this.container.getDocument().body);
}if(this.options.style){if(this.options.modifiers.x=="left"&&this.options.modifiers.y=="top"){var c=b.getOffsetParent(),d=b.getStyles("left","top");if(c&&(d.left=="auto"||d.top=="auto")){b.setPosition(b.getPosition(c));
}}if(b.getStyle("position")=="static"){b.setStyle("position","absolute");}}this.addEvent("start",this.checkDroppables,true);this.overed=null;},start:function(a){if(this.container){this.options.limit=this.calculateLimit();
}if(this.options.precalculate){this.positions=this.droppables.map(function(b){return b.getCoordinates();});}this.parent(a);},calculateLimit:function(){var j=this.element,e=this.container,d=document.id(j.getOffsetParent())||document.body,h=e.getCoordinates(d),c={},b={},k={},g={},m={};

View File

@ -66,7 +66,7 @@ mindplot.widget.FloatingTip = new Class({
},
show:function (element) {
var old = $(element).retrieve('floatingtip');
var old = document.id(element).retrieve('floatingtip');
if (old){
if (old.getStyle('opacity') == 1) {
clearTimeout(old.retrieve('timeout'));

View File

@ -26,12 +26,12 @@ mindplot.widget.Menu = new Class({
var widgetsBaseUrl = baseUrl + "css/widget";
// Stop event propagation ...
$(this._containerId).addEvent('click', function (event) {
document.id(this._containerId).addEvent('click', function (event) {
event.stopPropagation();
return false;
});
$(this._containerId).addEvent('dblclick', function (event) {
document.id(this._containerId).addEvent('dblclick', function (event) {
event.stopPropagation();
return false;
});
@ -39,7 +39,7 @@ mindplot.widget.Menu = new Class({
// Create panels ...
var designerModel = designer.getModel();
var fontFamilyBtn = $('fontFamily');
var fontFamilyBtn = document.id('fontFamily');
if (fontFamilyBtn) {
var fontFamilyModel = {
getValue:function () {
@ -65,7 +65,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('fontFamily', $msg('FONT_FAMILY'));
}
var fontSizeBtn = $('fontSize');
var fontSizeBtn = document.id('fontSize');
if (fontSizeBtn) {
var fontSizeModel = {
getValue:function () {
@ -89,7 +89,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('fontSize', $msg('FONT_SIZE'));
}
var topicShapeBtn = $('topicShape');
var topicShapeBtn = document.id('topicShape');
if (topicShapeBtn) {
var topicShapeModel = {
getValue:function () {
@ -113,7 +113,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('topicShape', $msg('TOPIC_SHAPE'));
}
var topicIconBtn = $('topicIcon');
var topicIconBtn = document.id('topicIcon');
if (topicIconBtn) {
// Create icon panel dialog ...
var topicIconModel = {
@ -129,7 +129,7 @@ mindplot.widget.Menu = new Class({
}
// Topic color item ...
var topicColorBtn = $('topicColor');
var topicColorBtn = document.id('topicColor');
if (topicColorBtn) {
var topicColorModel = {
@ -155,7 +155,7 @@ mindplot.widget.Menu = new Class({
}
// Border color item ...
var topicBorderBtn = $('topicBorder');
var topicBorderBtn = document.id('topicBorder');
if (topicBorderBtn) {
var borderColorModel =
{
@ -181,7 +181,7 @@ mindplot.widget.Menu = new Class({
}
// Font color item ...
var fontColorBtn = $('fontColor');
var fontColorBtn = document.id('fontColor');
if (fontColorBtn) {
var fontColorModel =
{
@ -316,7 +316,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('fontItalic', $msg('FONT_ITALIC'), "meta+I");
var saveElem = $('save');
var saveElem = document.id('save');
if (saveElem) {
this._addButton('save', false, false, function () {
this.save(saveElem, designer, true);
@ -327,7 +327,7 @@ mindplot.widget.Menu = new Class({
if (!readOnly) {
// To prevent the user from leaving the page with changes ...
Element.NativeEvents.unload = 1;
$(window).addEvent('unload', function () {
document.id(window).addEvent('unload', function () {
if (this.isSaveRequired()) {
this.save(saveElem, designer, false, true);
}
@ -343,7 +343,7 @@ mindplot.widget.Menu = new Class({
}
}
var discardElem = $('discard');
var discardElem = document.id('discard');
if (discardElem) {
this._addButton('discard', false, false, function () {
this.discardChanges(designer);
@ -351,7 +351,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('discard', $msg('DISCARD_CHANGES'));
}
var shareElem = $('shareIt');
var shareElem = document.id('shareIt');
if (shareElem) {
this._addButton('shareIt', false, false, function () {
var reqDialog = new MooDialog.Request('c/iframeWrapper?url=c/maps/' + mapId + "/sharef", null,
@ -371,7 +371,7 @@ mindplot.widget.Menu = new Class({
}
var publishElem = $('publishIt');
var publishElem = document.id('publishIt');
if (publishElem) {
this._addButton('publishIt', false, false, function () {
var reqDialog = new MooDialog.Request('c/iframeWrapper?url=c/maps/' + mapId + "/publishf", null,
@ -391,7 +391,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('publishIt', $msg('PUBLISH'));
}
var historyElem = $('history');
var historyElem = document.id('history');
if (historyElem) {
this._addButton('history', false, false, function () {
@ -413,7 +413,7 @@ mindplot.widget.Menu = new Class({
this._registerEvents(designer);
// Keyboard Shortcuts Action ...
var keyboardShortcut = $('keyboardShortcuts');
var keyboardShortcut = document.id('keyboardShortcuts');
if (keyboardShortcut) {
keyboardShortcut.addEvent('click', function (event) {
@ -434,7 +434,7 @@ mindplot.widget.Menu = new Class({
}
var videoElem = $("tutorialVideo");
var videoElem = document.id("tutorialVideo");
if (videoElem) {
var width = 900;
var height = 500;
@ -501,7 +501,7 @@ mindplot.widget.Menu = new Class({
_addButton:function (buttonId, topic, rel, fn) {
// Register Events ...
var result = null;
if ($(buttonId)) {
if (document.id(buttonId)) {
var button = new mindplot.widget.ToolbarItem(buttonId, function (event) {
fn(event);
@ -515,13 +515,13 @@ mindplot.widget.Menu = new Class({
},
_registerTooltip:function (buttonId, text, shortcut) {
if ($(buttonId)) {
if (document.id(buttonId)) {
var tooltip = text;
if (shortcut) {
shortcut = Browser.Platform.mac ? shortcut.replace("meta+", "⌘") : shortcut.replace("meta+", "ctrl+");
tooltip = tooltip + " (" + shortcut + ")";
}
new mindplot.widget.KeyboardShortcutTooltip($(buttonId), tooltip);
new mindplot.widget.KeyboardShortcutTooltip(document.id(buttonId), tooltip);
}
}
});

View File

@ -32,7 +32,7 @@ mindplot.widget.ToolbarItem = new Class({
_registerTip: function() {
return new mindplot.widget.FloatingTip($(this._buttonId), {
return new mindplot.widget.FloatingTip(document.id(this._buttonId), {
html: false,
position: 'bottom',
arrowOffset : 5,
@ -50,7 +50,7 @@ mindplot.widget.ToolbarItem = new Class({
},
getButtonElem : function() {
var elem = $(this._buttonId);
var elem = document.id(this._buttonId);
$assert(elem, "Could not find element for " + this._buttonId);
return elem;
}.protect(),

View File

@ -19,7 +19,7 @@
mindplot.widget.ToolbarNotifier = new Class({
initialize:function () {
var container = $('headerNotifier');
var container = document.id('headerNotifier');
// In case of print,embedded no message is displayed ....
if (container) {
this._effect = new Fx.Elements(container, {
@ -44,14 +44,14 @@ mindplot.widget.ToolbarNotifier = new Class({
logMessage:function (msg, fade) {
$assert(msg, 'msg can not be null');
var container = $('headerNotifier');
var container = document.id('headerNotifier');
// In case of print,embedded no message is displayed ....
if (container) {
container.set('text', msg);
container.setStyle('display', 'block');
container.position({
relativeTo:$('header'),
relativeTo:document.id('header'),
position:'upperCenter',
edge:'centerTop'
});

View File

@ -11,7 +11,7 @@ TestCase("Mindplot test",{
buildMindmapDesigner();
// Register Events ...
// $(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
// document.id(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer));
/*// Autosave ...
if (!isTryMode)
@ -44,7 +44,7 @@ TestCase("Mindplot test",{
{
// Initialize message logger ...
var container = $('mindplot');
var container = document.id('mindplot');
// Initialize Editor ...
@ -76,7 +76,7 @@ TestCase("Mindplot test",{
afterMindpotLibraryLoading();
},
testWorkspaceBuild:function(){
assertNotNull($('workspace'));
assertNotNull(document.id('workspace'));
},
testCentralTopicPresent:function(){
var centralTopic = designer.getCentralTopic();

View File

@ -19,7 +19,7 @@ mindplot.layout.BalancedTestSuite = new Class({
Extends: mindplot.layout.TestSuite,
initialize:function() {
$("balancedTest").setStyle("display","block");
document.id("balancedTest").setStyle("display","block");
this.testBalanced();
this.testBalancedPredict();

View File

@ -19,7 +19,7 @@ mindplot.layout.FreeTestSuite = new Class({
Extends: mindplot.layout.TestSuite,
initialize:function() {
$("freeTest").setStyle("display","block");
document.id("freeTest").setStyle("display","block");
this.testFreePosition();
this.testFreePredict();

View File

@ -19,7 +19,7 @@ mindplot.layout.SymmetricTestSuite = new Class({
Extends: mindplot.layout.TestSuite,
initialize:function() {
$("symmetricTest").setStyle("display","block");
document.id("symmetricTest").setStyle("display","block");
this.testSymmetry();
this.testSymmetricPredict();

View File

@ -19,7 +19,7 @@ mindplot.layout.TestSuite = new Class({
Extends: mindplot.layout.ChildrenSorterStrategy,
initialize:function() {
$("basicTest").setStyle("display","block");
document.id("basicTest").setStyle("display","block");
// this.testAligned();
this.testBaselineAligned1();