Remove UserAgent class. Use mootools.

This commit is contained in:
Paulo Veiga 2011-08-09 02:27:59 -03:00
parent 7d9af403fe
commit fb24d7c9a5
6 changed files with 6 additions and 142 deletions

View File

@ -54,7 +54,6 @@
<include>${basedir}/target/tmp/log4js-min.js</include>
<include>${basedir}/target/tmp/Monitor-min.js</include>
<include>${basedir}/target/tmp/Point-min.js</include>
<include>${basedir}/target/tmp/UserAgent-min.js</include>
<include>${basedir}/target/tmp/Utils-min.js</include>
<include>${basedir}/target/tmp/WaitDialog-min.js</include>
<include>${basedir}/target/tmp/footer-min.js</include>

View File

@ -1,135 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
core.UserAgent = {
isMozillaFamily: function()
{
return this.browser == "Netscape" || this.browser == "Firefox";
},
isIE: function()
{
return this.browser == "Explorer";
},
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
},
dataBrowser: [
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
string: navigator.vendor,
subString: "Google Inc.",
identity: "Chrome"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
core.UserAgent.init();

View File

@ -159,7 +159,7 @@ mindplot.MindmapDesigner = new Class({
var selectableObjects = this.getSelectedObjects();
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
if (!$defined(event) || event.ctrlKey == false) {
if (!$defined(event) || (event.ctrlKey == false && event.metaKey == false)) {
selectableObjects.forEach(function(selectableObject) {
if (selectableObject.isOnFocus() && selectableObject != currentObject) {
selectableObject.setOnFocus(false);
@ -333,7 +333,7 @@ mindplot.MindmapDesigner = new Class({
this._actionRunner.markAsChangeBase();
},
loadFromCollaborativeModel: function(collaborationManager){
loadFromCollaborativeModel: function(collaborationManager) {
var mindmap = collaborationManager.buildWiseModel();
this._loadMap(1, mindmap);
@ -745,7 +745,7 @@ mindplot.MindmapDesigner = new Class({
dialog.adopt(msg).show();
// IE doesn't like too much this focus action...
if (!core.UserAgent.isIE()) {
if (!Browser.ie) {
urlInput.focus();
}
}

View File

@ -171,7 +171,7 @@ mindplot.Workspace = new Class({
workspace.setCoordOrigin(coordOriginX, coordOriginY);
// Change cursor.
if (core.UserAgent.isMozillaFamily()) {
if (Browser.firefox) {
window.document.body.style.cursor = "-moz-grabbing";
} else {
window.document.body.style.cursor = "move";

View File

@ -98,7 +98,7 @@ TestCase("Mindplot test",{
var fireNativeEvent = function(type, target, position){
var event;
if(core.UserAgent.isIE()){
if(Browser.ie){
event = document.createEventObject();
event.screenX = position.x;
event.screenY = position.y;

View File

@ -24,7 +24,7 @@
console.log("value:" + value);
}
};
var palette = new mindplot.widget.ColorPalette('myButton', model,"/mindplot/src/main/javascript/widget");
var palette = new mindplot.widget.ColorPalettePanel('myButton', model,"/mindplot/src/main/javascript/widget");
});
</script>