mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
- Update IE parser to Msxml2.DOMDocument.6.0
This commit is contained in:
parent
8a8922f2a6
commit
ff63b4f89c
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
@ -21,7 +21,7 @@ core.Utils = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
core.Utils.innerXML = function(/*Node*/node) {
|
core.Utils.innerXML = function (node) {
|
||||||
// summary:
|
// summary:
|
||||||
// Implementation of MS's innerXML function.
|
// Implementation of MS's innerXML function.
|
||||||
if ($defined(node.innerXML)) {
|
if ($defined(node.innerXML)) {
|
||||||
@ -36,29 +36,26 @@ core.Utils.innerXML = function(/*Node*/node) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
core.Utils.createDocument = function() {
|
/**
|
||||||
// summary:
|
* Cross-browser implementation of creating an XML document object.
|
||||||
// cross-browser implementation of creating an XML document object.
|
*/
|
||||||
|
core.Utils.createDocument = function () {
|
||||||
var doc = null;
|
var doc = null;
|
||||||
var _document = window.document;
|
|
||||||
if ($defined(window.ActiveXObject)) {
|
if ($defined(window.ActiveXObject)) {
|
||||||
var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ];
|
//http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx
|
||||||
for (var i = 0; i < prefixes.length; i++) {
|
var progIDs = [ 'Msxml2.DOMDocument.6.0', 'Msxml2.DOMDocument.3.0'];
|
||||||
|
for (var i = 0; i < progIDs.length; i++) {
|
||||||
try {
|
try {
|
||||||
doc = new ActiveXObject(prefixes[i] + ".XMLDOM");
|
doc = new ActiveXObject(progIDs[i]);
|
||||||
} catch(e) { /* squelch */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($defined(doc)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
catch (ex) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if ((_document.implementation) &&
|
} else if (window.document.implementation && window.document.implementation.createDocument) {
|
||||||
(_document.implementation.createDocument)) {
|
doc = window.document.implementation.createDocument("", "", null);
|
||||||
doc = _document.implementation.createDocument("", "", null);
|
|
||||||
}
|
}
|
||||||
|
$asser(doc, "Parser could not be instantiated");
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
// DOMDocument
|
|
||||||
};
|
};
|
@ -47,7 +47,7 @@ mindplot.NoteIcon = new Class({
|
|||||||
var result = new Element('div');
|
var result = new Element('div');
|
||||||
result.setStyles({padding:'5px'});
|
result.setStyles({padding:'5px'});
|
||||||
|
|
||||||
var title = new Element('div', {text:'Note'});
|
var title = new Element('div', {text:$msg('NOTE')});
|
||||||
title.setStyles({
|
title.setStyles({
|
||||||
'font-weight':'bold',
|
'font-weight':'bold',
|
||||||
color:'black',
|
color:'black',
|
||||||
|
@ -17,37 +17,37 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.widget.FloatingTip = new Class({
|
mindplot.widget.FloatingTip = new Class({
|
||||||
Implements: [Options, Events],
|
Implements:[Options, Events],
|
||||||
|
|
||||||
options: {
|
options:{
|
||||||
position: 'top',
|
position:'top',
|
||||||
center: true,
|
center:true,
|
||||||
content: 'title',
|
content:'title',
|
||||||
html: false,
|
html:false,
|
||||||
balloon: true,
|
balloon:true,
|
||||||
arrowSize: 6,
|
arrowSize:6,
|
||||||
arrowOffset: 6,
|
arrowOffset:6,
|
||||||
distance: 7,
|
distance:7,
|
||||||
motion: 40,
|
motion:40,
|
||||||
motionOnShow: true,
|
motionOnShow:true,
|
||||||
motionOnHide: true,
|
motionOnHide:true,
|
||||||
showOn: 'mouseenter',
|
showOn:'mouseenter',
|
||||||
hideOn: 'mouseleave',
|
hideOn:'mouseleave',
|
||||||
showDelay: 500,
|
showDelay:500,
|
||||||
hideDelay: 250,
|
hideDelay:250,
|
||||||
className: 'floating-tip',
|
className:'floating-tip',
|
||||||
offset: {x: 0, y: 0},
|
offset:{x:0, y:0},
|
||||||
preventHideOnOver: true,
|
preventHideOnOver:true,
|
||||||
fx: { 'duration': 'short' }
|
fx:{ 'duration':'short' }
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(element, options) {
|
initialize:function (element, options) {
|
||||||
this.setOptions(options);
|
this.setOptions(options);
|
||||||
this.boundShow = function() {
|
this.boundShow = function () {
|
||||||
this.show(element);
|
this.show(element);
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
this.boundHide = function() {
|
this.boundHide = function () {
|
||||||
this.hide(element);
|
this.hide(element);
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
this.attach(element);
|
this.attach(element);
|
||||||
},
|
},
|
||||||
|
|
||||||
attach: function(element) {
|
attach:function (element) {
|
||||||
if (element.retrieve('hasEvents') !== null) {
|
if (element.retrieve('hasEvents') !== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -65,11 +65,13 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
element.store('hasEvents', true);
|
element.store('hasEvents', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(element) {
|
show:function (element) {
|
||||||
var old = element.retrieve('floatingtip');
|
var old = element.retrieve('floatingtip');
|
||||||
if (old) if (old.getStyle('opacity') == 1) {
|
if (old){
|
||||||
clearTimeout(old.retrieve('timeout'));
|
if (old.getStyle('opacity') == 1) {
|
||||||
return this;
|
clearTimeout(old.retrieve('timeout'));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var tip = this._create(element);
|
var tip = this._create(element);
|
||||||
if (tip == null)
|
if (tip == null)
|
||||||
@ -87,7 +89,7 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function(element) {
|
hide:function (element) {
|
||||||
var tip = element.retrieve('floatingtip');
|
var tip = element.retrieve('floatingtip');
|
||||||
if (!tip) {
|
if (!tip) {
|
||||||
if (this.options.position == 'inside') {
|
if (this.options.position == 'inside') {
|
||||||
@ -96,7 +98,8 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
tip = element.retrieve('floatingtip');
|
tip = element.retrieve('floatingtip');
|
||||||
} catch (x) {
|
} catch (x) {
|
||||||
}
|
}
|
||||||
if (!tip) return this;
|
if (!tip)
|
||||||
|
return this;
|
||||||
} else {
|
} else {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -106,7 +109,7 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
_create: function(elem) {
|
_create:function (elem) {
|
||||||
|
|
||||||
var o = this.options;
|
var o = this.options;
|
||||||
var oc = o.content;
|
var oc = o.content;
|
||||||
@ -114,13 +117,14 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
|
|
||||||
if (oc == 'title') {
|
if (oc == 'title') {
|
||||||
oc = 'floatingtitle';
|
oc = 'floatingtitle';
|
||||||
if (!elem.get('floatingtitle')) elem.setProperty('floatingtitle', elem.get('title'));
|
if (!elem.get('floatingtitle'))
|
||||||
|
elem.setProperty('floatingtitle', elem.get('title'));
|
||||||
elem.set('title', '');
|
elem.set('title', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
var cnt = (typeof(oc) == 'string' ? elem.get(oc) : oc(elem));
|
var cnt = (typeof(oc) == 'string' ? elem.get(oc) : oc(elem));
|
||||||
var cwr = new Element('div').addClass(o.className).setStyle('margin', 0);
|
var cwr = new Element('div').addClass(o.className).setStyle('margin', 0);
|
||||||
var tip = new Element('div').addClass(o.className + '-wrapper').setStyles({ 'margin': 0, 'padding': 0, 'z-index': cwr.getStyle('z-index') }).adopt(cwr);
|
var tip = new Element('div').addClass(o.className + '-wrapper').setStyles({ 'margin':0, 'padding':0, 'z-index':cwr.getStyle('z-index') }).adopt(cwr);
|
||||||
|
|
||||||
if (cnt) {
|
if (cnt) {
|
||||||
if (o.html)
|
if (o.html)
|
||||||
@ -132,12 +136,12 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body = document.id(document.body);
|
var body = document.id(document.body);
|
||||||
tip.setStyles({ 'position': 'absolute', 'opacity': 0, 'top': 0, 'left': 0 }).inject(body);
|
tip.setStyles({ 'position':'absolute', 'opacity':0, 'top':0, 'left':0 }).inject(body);
|
||||||
|
|
||||||
if (o.balloon && !Browser.ie6) {
|
if (o.balloon && !Browser.ie6) {
|
||||||
|
|
||||||
var trg = new Element('div').addClass(o.className + '-triangle').setStyles({ 'margin': 0, 'padding': 0 });
|
var trg = new Element('div').addClass(o.className + '-triangle').setStyles({ 'margin':0, 'padding':0 });
|
||||||
var trgSt = { 'border-color': cwr.getStyle('background-color'), 'border-width': o.arrowSize, 'border-style': 'solid','width': 0, 'height': 0 };
|
var trgSt = { 'border-color':cwr.getStyle('background-color'), 'border-width':o.arrowSize, 'border-style':'solid', 'width':0, 'height':0 };
|
||||||
|
|
||||||
switch (opos) {
|
switch (opos) {
|
||||||
case 'inside':
|
case 'inside':
|
||||||
@ -191,12 +195,12 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
trgC.height = !$defined(trgC.height) ? 0 : trgC.height;
|
trgC.height = !$defined(trgC.height) ? 0 : trgC.height;
|
||||||
trgC.width = !$defined(trgC.width) ? 0 : trgC.width;
|
trgC.width = !$defined(trgC.width) ? 0 : trgC.width;
|
||||||
|
|
||||||
var pos = { x: trgC.left + o.offset.x, y: trgC.top + o.offset.y };
|
var pos = { x:trgC.left + o.offset.x, y:trgC.top + o.offset.y };
|
||||||
|
|
||||||
if (opos == 'inside') {
|
if (opos == 'inside') {
|
||||||
tip.setStyles({ 'width': tip.getStyle('width'), 'height': tip.getStyle('height') });
|
tip.setStyles({ 'width':tip.getStyle('width'), 'height':tip.getStyle('height') });
|
||||||
elem.setStyle('position', 'relative').adopt(tip);
|
elem.setStyle('position', 'relative').adopt(tip);
|
||||||
pos = { x: o.offset.x, y: o.offset.y };
|
pos = { x:o.offset.x, y:o.offset.y };
|
||||||
} else {
|
} else {
|
||||||
switch (opos) {
|
switch (opos) {
|
||||||
case 'top':
|
case 'top':
|
||||||
@ -232,19 +236,19 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
tip.set('morph', o.fx).store('position', pos);
|
tip.set('morph', o.fx).store('position', pos);
|
||||||
tip.setStyles({ 'top': pos.y, 'left': pos.x });
|
tip.setStyles({ 'top':pos.y, 'left':pos.x });
|
||||||
|
|
||||||
return tip;
|
return tip;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_animate: function(tip, d) {
|
_animate:function (tip, d) {
|
||||||
|
|
||||||
clearTimeout(tip.retrieve('timeout'));
|
clearTimeout(tip.retrieve('timeout'));
|
||||||
tip.store('timeout', (function(t) {
|
tip.store('timeout', (function (t) {
|
||||||
|
|
||||||
var o = this.options, din = (d == 'in');
|
var o = this.options, din = (d == 'in');
|
||||||
var m = { 'opacity': din ? 1 : 0 };
|
var m = { 'opacity':din ? 1 : 0 };
|
||||||
|
|
||||||
if ((o.motionOnShow && din) || (o.motionOnHide && !din)) {
|
if ((o.motionOnShow && din) || (o.motionOnHide && !din)) {
|
||||||
var pos = t.retrieve('position');
|
var pos = t.retrieve('position');
|
||||||
@ -267,7 +271,7 @@ mindplot.widget.FloatingTip = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.morph(m);
|
t.morph(m);
|
||||||
if (!din) t.get('morph').chain(function() {
|
if (!din) t.get('morph').chain(function () {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}.bind(t));
|
}.bind(t));
|
||||||
|
|
||||||
|
@ -17,70 +17,70 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.widget.LinkIconTooltip = new Class({
|
mindplot.widget.LinkIconTooltip = new Class({
|
||||||
Extends: mindplot.widget.FloatingTip,
|
Extends:mindplot.widget.FloatingTip,
|
||||||
|
|
||||||
initialize : function(linkIcon) {
|
initialize:function (linkIcon) {
|
||||||
$assert(linkIcon, "linkIcon can not be null");
|
$assert(linkIcon, "linkIcon can not be null");
|
||||||
this.parent(linkIcon.getImage()._peer._native, {
|
this.parent(linkIcon.getImage()._peer._native, {
|
||||||
// Content can also be a function of the target element!
|
// Content can also be a function of the target element!
|
||||||
content: this._buildContent.pass(linkIcon, this),
|
content:this._buildContent.pass(linkIcon, this),
|
||||||
html: true,
|
html:true,
|
||||||
position: 'bottom',
|
position:'bottom',
|
||||||
arrowOffset : 10,
|
arrowOffset:10,
|
||||||
center: true,
|
center:true,
|
||||||
arrowSize: 15,
|
arrowSize:15,
|
||||||
offset : {x:10,y:20},
|
offset:{x:10, y:20},
|
||||||
className: 'linkTip'
|
className:'linkTip'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildContent : function(linkIcon) {
|
_buildContent:function (linkIcon) {
|
||||||
var result = new Element('div');
|
var result = new Element('div');
|
||||||
result.setStyles({
|
result.setStyles({
|
||||||
padding:'5px',
|
padding:'5px',
|
||||||
width:'100%'
|
width:'100%'
|
||||||
});
|
});
|
||||||
|
|
||||||
var title = new Element('div', {text:'Link'});
|
var title = new Element('div', {text:$msg('LINK')});
|
||||||
title.setStyles({
|
title.setStyles({
|
||||||
'font-weight':'bold',
|
'font-weight':'bold',
|
||||||
color:'black',
|
color:'black',
|
||||||
'padding-bottom':'5px',
|
'padding-bottom':'5px',
|
||||||
width: '100px'
|
width:'100px'
|
||||||
});
|
});
|
||||||
title.inject(result);
|
title.inject(result);
|
||||||
|
|
||||||
var text = new Element('div', {text: "URL: " + linkIcon.getModel().getUrl()});
|
var text = new Element('div', {text:"URL: " + linkIcon.getModel().getUrl()});
|
||||||
text.setStyles({
|
text.setStyles({
|
||||||
'white-space': 'pre-wrap',
|
'white-space':'pre-wrap',
|
||||||
'word-wrap': 'break-word'
|
'word-wrap':'break-word'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
text.inject(result);
|
text.inject(result);
|
||||||
|
|
||||||
var imgContainer = new Element('div');
|
var imgContainer = new Element('div');
|
||||||
imgContainer.setStyles({
|
imgContainer.setStyles({
|
||||||
width: '100%',
|
width:'100%',
|
||||||
textAlign: 'right',
|
textAlign:'right',
|
||||||
'padding-bottom':'5px',
|
'padding-bottom':'5px',
|
||||||
'padding-top': '5px'
|
'padding-top':'5px'
|
||||||
});
|
});
|
||||||
|
|
||||||
var img = new Element('img', {
|
var img = new Element('img', {
|
||||||
src: 'http://open.thumbshots.org/image.pxf?url=' + linkIcon.getModel().getUrl(),
|
src:'http://open.thumbshots.org/image.pxf?url=' + linkIcon.getModel().getUrl(),
|
||||||
img : linkIcon.getModel().getUrl(),
|
img:linkIcon.getModel().getUrl(),
|
||||||
alt : linkIcon.getModel().getUrl()
|
alt:linkIcon.getModel().getUrl()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
img.setStyles({
|
img.setStyles({
|
||||||
padding: '5px'
|
padding:'5px'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
var link = new Element('a', {
|
var link = new Element('a', {
|
||||||
href : linkIcon.getModel().getUrl(),
|
href:linkIcon.getModel().getUrl(),
|
||||||
alt : 'Open in new window ...',
|
alt:'Open in new window ...',
|
||||||
target : '_blank'
|
target:'_blank'
|
||||||
|
|
||||||
});
|
});
|
||||||
img.inject(link);
|
img.inject(link);
|
||||||
|
@ -54,4 +54,5 @@ WRITE_YOUR_TEXT_HERE=Write your note here ...
|
|||||||
REMOVE=Remove
|
REMOVE=Remove
|
||||||
ACCEPT=Accept
|
ACCEPT=Accept
|
||||||
CANCEL=Cancel
|
CANCEL=Cancel
|
||||||
|
LINK=Link
|
||||||
|
|
||||||
|
@ -55,3 +55,4 @@ WRITE_YOUR_TEXT_HERE=Escribe tu nota aquí ...
|
|||||||
REMOVE=Borrar
|
REMOVE=Borrar
|
||||||
ACCEPT=Aceptar
|
ACCEPT=Aceptar
|
||||||
CANCEL=Cancelar
|
CANCEL=Cancelar
|
||||||
|
LINK=Enlace
|
@ -58,3 +58,4 @@ ACCEPT=Accepter
|
|||||||
CANCEL=Annuler
|
CANCEL=Annuler
|
||||||
REMOVE=Supprimer
|
REMOVE=Supprimer
|
||||||
WRITE_YOUR_TEXT_HERE=Écrivez votre texte ici ...
|
WRITE_YOUR_TEXT_HERE=Écrivez votre texte ici ...
|
||||||
|
LINK=Lien
|
||||||
|
Loading…
Reference in New Issue
Block a user