mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-24 06:05:56 -05:00
Move common javascript functions to util.js closes #69
Javascript fixes for Safari
This commit is contained in:
parent
5d29ec0dbd
commit
91df6a5abf
@ -9,7 +9,7 @@ adminroot_DATA = ftr.html linkOpaque.gif status.html aspl-license.txt \
|
||||
gpl-license.html aspl-license.html thanks.html feedback.html \
|
||||
playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \
|
||||
smartpopup.html applet.html mt-daapd.js CREDITS status.js \
|
||||
config.js config.xml spinner.gif
|
||||
config.js config.xml spinner.gif util.js
|
||||
|
||||
EXTRA_DIST = ftr.html linkOpaque.gif status.html aspl-license.txt \
|
||||
gpl-license.txt linkTransparent.gif config-update.html hdr.html \
|
||||
@ -17,5 +17,5 @@ EXTRA_DIST = ftr.html linkOpaque.gif status.html aspl-license.txt \
|
||||
gpl-license.html aspl-license.html thanks.html feedback.html \
|
||||
playlist.html playlist.js smart.html smart.js DAAPApplet-0.1.jar \
|
||||
smartpopup.html applet.html mt-daapd.js CREDITS status.js \
|
||||
config.js config.xml spinner.gif
|
||||
config.js config.xml spinner.gif util.js
|
||||
|
||||
|
@ -36,6 +36,7 @@ var ConfigXML = {
|
||||
$A(item.attributes).each(function (attr) {
|
||||
returnItem[attr.name] = attr.value;
|
||||
});
|
||||
Element.cleanWhitespace(item);
|
||||
$A(item.childNodes).each(function (node) {
|
||||
if (Element.textContent(node) == '') {
|
||||
return;
|
||||
@ -447,75 +448,4 @@ var i=0;
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
Object.extend(Element, {
|
||||
removeChildren: function(element) {
|
||||
while(element.hasChildNodes()) {
|
||||
element.removeChild(element.firstChild);
|
||||
}
|
||||
},
|
||||
textContent: function(node) {
|
||||
if ((!node) || !node.hasChildNodes()) {
|
||||
// Empty text node
|
||||
return '';
|
||||
} else {
|
||||
if (node.textContent) {
|
||||
// W3C ?
|
||||
return node.textContent;
|
||||
} else if (node.text) {
|
||||
// IE
|
||||
return node.text;
|
||||
}
|
||||
}
|
||||
// We shouldn't end up here;
|
||||
return '';
|
||||
}
|
||||
});
|
||||
/* Detta script finns att hamta pa http://www.jojoxx.net och
|
||||
far anvandas fritt sa lange som dessa rader star kvar. */
|
||||
function DataDumper(obj,n,prefix){
|
||||
var str=""; prefix=(prefix)?prefix:""; n=(n)?n+1:1; var ind=""; for(var i=0;i<n;i++){ ind+=" "; }
|
||||
if(typeof(obj)=="string"){
|
||||
str+=ind+prefix+"String:\""+obj+"\"\n";
|
||||
} else if(typeof(obj)=="number"){
|
||||
str+=ind+prefix+"Number:"+obj+"\n";
|
||||
} else if(typeof(obj)=="function"){
|
||||
str+=ind+prefix+"Function:"+obj+"\n";
|
||||
} else if(typeof(obj) == 'boolean') {
|
||||
str+=ind+prefix+"Boolean:" + obj + "\n";
|
||||
} else {
|
||||
var type="Array";
|
||||
for(var i in obj){ type=(type=="Array"&&i==parseInt(i))?"Array":"Object"; }
|
||||
str+=ind+prefix+type+"[\n";
|
||||
if(type=="Array"){
|
||||
for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); }
|
||||
} else {
|
||||
for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); }
|
||||
}
|
||||
str+=ind+"]\n";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
var Cookie = {
|
||||
getVar: function(name) {
|
||||
var cookie = document.cookie;
|
||||
if (cookie.length > 0) {
|
||||
cookie += ';';
|
||||
}
|
||||
re = new RegExp(name + '\=(.*?);' );
|
||||
if (cookie.match(re)) {
|
||||
return RegExp.$1;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
setVar: function(name,value,days) {
|
||||
days = days || 30;
|
||||
var expire = new Date(new Date().getTime() + days*86400);
|
||||
document.cookie = name + '=' + value +';expires=' + expire.toUTCString();
|
||||
},
|
||||
removeVar: function(name) {
|
||||
var date = new Date(12);
|
||||
document.cookie = name + '=;expires=' + date.toUTCString();
|
||||
}
|
||||
};
|
||||
}
|
@ -6,13 +6,16 @@
|
||||
<link rel="stylesheet" type="text/css" href="mt-daapd.css" />
|
||||
@ispage config.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
|
||||
@ispage config.html:<script type="text/javascript" src="lib-js/script.aculo.us/scriptaculous.js"></script>:@
|
||||
@ispage config.html:<script type="text/javascript" src="util.js"></script>:@
|
||||
@ispage config.html:<script type="text/javascript" src="config.js"></script>:@
|
||||
@ispage status.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
|
||||
@ispage status.html:<script type="text/javascript" src="lib-js/script.aculo.us/effects.js"></script>:@
|
||||
@ispage status.html:<script type="text/javascript" src="util.js"></script>:@
|
||||
@ispage status.html:<script type="text/javascript" src="status.js"></script>:@
|
||||
@ispage smart.html:<script type="text/javascript" src="smart.js"></script>:@
|
||||
@ispage playlist.html:<script type="text/javascript" src="lib-js/prototype.js"></script>:@
|
||||
@ispage playlist.html:<script type="text/javascript" src="lib-js/script.aculo.us/builder.js"></script>:@
|
||||
@ispage playlist.html:<script type="text/javascript" src="util.js"></script>:@
|
||||
@ispage playlist.html:<script type="text/javascript" src="lib-js/rico.js"></script>:@
|
||||
@ispage playlist.html:<script type="text/javascript" src="playlist.js"></script>:@
|
||||
<script type="text/javascript" src="mt-daapd.js"></script>
|
||||
|
@ -694,29 +694,6 @@ SelectedRows = {
|
||||
}
|
||||
};
|
||||
|
||||
Object.extend(Element, {
|
||||
removeChildren: function(element) {
|
||||
while(element.hasChildNodes()) {
|
||||
element.removeChild(element.firstChild);
|
||||
}
|
||||
},
|
||||
textContent: function(node) {
|
||||
if ((!node) || !node.hasChildNodes()) {
|
||||
// Empty text node
|
||||
return '';
|
||||
} else {
|
||||
if (node.textContent) {
|
||||
// W3C ?
|
||||
return node.textContent;
|
||||
} else if (node.text) {
|
||||
// IE
|
||||
return node.text;
|
||||
}
|
||||
}
|
||||
// We shouldn't end up here;
|
||||
return '';
|
||||
}
|
||||
});
|
||||
String.prototype.encode = function () {
|
||||
return encodeURIComponent(this).replace(/\'/g,"\\'");
|
||||
};
|
||||
@ -727,28 +704,3 @@ String.prototype.truncate = function(length, truncation) {
|
||||
var ret = (this.length > length) ? this.slice(0, length - truncation.length) + truncation : this;
|
||||
return '' + ret;
|
||||
};
|
||||
/* Detta script finns att hamta pa http://www.jojoxx.net och
|
||||
far anvandas fritt sa lange som dessa rader star kvar. */
|
||||
function DataDumper(obj,n,prefix){
|
||||
var str=""; prefix=(prefix)?prefix:""; n=(n)?n+1:1; var ind=""; for(var i=0;i<n;i++){ ind+=" "; }
|
||||
if(typeof(obj)=="string"){
|
||||
str+=ind+prefix+"String:\""+obj+"\"\n";
|
||||
} else if(typeof(obj)=="number"){
|
||||
str+=ind+prefix+"Number:"+obj+"\n";
|
||||
} else if(typeof(obj)=="function"){
|
||||
str+=ind+prefix+"Function:"+obj+"\n";
|
||||
} else if(typeof(obj) == 'boolean') {
|
||||
str+=ind+prefix+"Boolean:" + obj + "\n";
|
||||
} else {
|
||||
var type="Array";
|
||||
for(var i in obj){ type=(type=="Array"&&i==parseInt(i))?"Array":"Object"; }
|
||||
str+=ind+prefix+type+"[\n";
|
||||
if(type=="Array"){
|
||||
for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); }
|
||||
} else {
|
||||
for(var i in obj){ str+=DataDumper(obj[i],n,i+"=>"); }
|
||||
}
|
||||
str+=ind+"]\n";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -88,50 +88,4 @@ Object.extend(Table.prototype,{
|
||||
});
|
||||
this.tbody.appendChild(tr);
|
||||
}
|
||||
});
|
||||
Object.extend(Element, {
|
||||
removeChildren: function(element) {
|
||||
while(element.hasChildNodes()) {
|
||||
element.removeChild(element.firstChild);
|
||||
}
|
||||
},
|
||||
textContent: function(node) {
|
||||
if ((!node) || !node.hasChildNodes()) {
|
||||
// Empty text node
|
||||
return '';
|
||||
} else {
|
||||
if (node.textContent) {
|
||||
// W3C ?
|
||||
return node.textContent;
|
||||
} else if (node.text) {
|
||||
// IE
|
||||
return node.text;
|
||||
}
|
||||
}
|
||||
// We shouldn't end up here;
|
||||
return '';
|
||||
}
|
||||
});
|
||||
var Cookie = {
|
||||
getVar: function(name) {
|
||||
var cookie = document.cookie;
|
||||
if (cookie.length > 0) {
|
||||
cookie += ';';
|
||||
}
|
||||
re = new RegExp(name + '\=(.*?);' );
|
||||
if (cookie.match(re)) {
|
||||
return RegExp.$1;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
setVar: function(name,value,days) {
|
||||
days = days || 30;
|
||||
var expire = new Date(new Date().getTime() + days*86400);
|
||||
document.cookie = name + '=' + value +';expires=' + expire.toUTCString();
|
||||
},
|
||||
removeVar: function(name) {
|
||||
var date = new Date(12);
|
||||
document.cookie = name + '=;expires=' + date.toUTCString();
|
||||
}
|
||||
};
|
||||
});
|
@ -154,6 +154,7 @@ Section "MainSection" SEC01
|
||||
File "${ADMIN_ROOT}\aspl-license.html"
|
||||
File "${ADMIN_ROOT}\applet.html"
|
||||
File "${ADMIN_ROOT}\spinner.gif"
|
||||
File "${ADMIN_ROOT}\util.js"
|
||||
SetOutPath "$2\admin-root\lib-js"
|
||||
File "${ADMIN_ROOT}\lib-js\prototype.js"
|
||||
File "${ADMIN_ROOT}\lib-js\rico.js"
|
||||
@ -431,6 +432,7 @@ Section Uninstall
|
||||
Delete "$INSTDIR\admin-root\smart.html"
|
||||
Delete "$INSTDIR\admin-root\smart.js"
|
||||
Delete "$INSTDIR\admin-root\spinner.gif"
|
||||
Delete "$INSTDIR\admin-root\util.js"
|
||||
Delete "$INSTDIR\admin-root\smartpopup.html"
|
||||
Delete "$INSTDIR\admin-root\status.html"
|
||||
Delete "$INSTDIR\admin-root\status.js"
|
||||
|
Loading…
Reference in New Issue
Block a user