mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
Fixed a bunch of issues with auxilliary JS
Now that Prototype is gone some of them are unhappy, and others are just plain broken.
This commit is contained in:
parent
f9e6540ed2
commit
cd8a01d2d4
3 changed files with 28 additions and 33 deletions
|
|
@ -19,7 +19,7 @@ var accessKeyHintsAdder = {
|
|||
var elemTypes = new Array('a','area','button','input','label','legend','textarea');
|
||||
for(var i = 0; i < elemTypes.length; i++)
|
||||
{
|
||||
this.addHint(document.getElementsByTagName(elemTypes[i]));
|
||||
accessKeyHintsAdder.addHint(document.getElementsByTagName(elemTypes[i]));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -66,4 +66,4 @@ var accessKeyHintsAdder = {
|
|||
|
||||
}
|
||||
|
||||
Event.observe(window, "load", accessKeyHintsAdder.run.bindAsEventListener(accessKeyHintsAdder));
|
||||
$(accessKeyHintsAdder.run);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
var niftyOk=(document.getElementById && document.createElement && Array.prototype.push);
|
||||
|
||||
String.prototype.find=function(what){
|
||||
return(this.indexOf(what)>=0 ? true : false);
|
||||
function strFind(str, what){
|
||||
return(str.indexOf(what)>=0 ? true : false);
|
||||
}
|
||||
|
||||
var oldonload=window.onload;
|
||||
|
|
@ -31,12 +31,12 @@ else window.onload=function(){NiftyLoad()};
|
|||
function Nifty(selector,options){
|
||||
if(niftyOk==false) return;
|
||||
var i,v=selector.split(","),h=0;
|
||||
if(options==null) options="";
|
||||
if(options.find("fixed-height"))
|
||||
if(options==undefined) options="";
|
||||
if(strFind(options,"fixed-height"))
|
||||
h=getElementsBySelector(v[0])[0].offsetHeight;
|
||||
for(i=0;i<v.length;i++)
|
||||
Rounded(v[i],options);
|
||||
if(options.find("height")) SameHeight(selector,h);
|
||||
if(strFind(options,"height")) SameHeight(selector,h);
|
||||
}
|
||||
|
||||
function Rounded(selector,options){
|
||||
|
|
@ -47,18 +47,18 @@ if(options!=""){
|
|||
options=options.replace("top","tr tl");
|
||||
options=options.replace("bottom","br bl");
|
||||
options=options.replace("transparent","alias");
|
||||
if(options.find("tl")){
|
||||
if(strFind(options,"tl")){
|
||||
top="both";
|
||||
if(!options.find("tr")) top="left";
|
||||
if(!strFind(options,"tr")) top="left";
|
||||
}
|
||||
else if(options.find("tr")) top="right";
|
||||
if(options.find("bl")){
|
||||
else if(strFind(options,"tr")) top="right";
|
||||
if(strFind(options,"bl")){
|
||||
bottom="both";
|
||||
if(!options.find("br")) bottom="left";
|
||||
if(!strFind(options,"br")) bottom="left";
|
||||
}
|
||||
else if(options.find("br")) bottom="right";
|
||||
else if(strFind(options,"br")) bottom="right";
|
||||
}
|
||||
if(top=="" && bottom=="" && !options.find("none")){top="both";bottom="both";}
|
||||
if(top=="" && bottom=="" && !strFind(options,"none")){top="both";bottom="both";}
|
||||
v=getElementsBySelector(selector);
|
||||
for(i=0;i<v.length;i++){
|
||||
FixIE(v[i]);
|
||||
|
|
@ -71,7 +71,7 @@ function AddTop(el,side,options){
|
|||
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
|
||||
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
|
||||
d.style.marginRight="-"+getPadding(el,"Right")+"px";
|
||||
if(options.find("alias") || (color=getBk(el))=="transparent"){
|
||||
if(strFind(options,"alias") || (color=getBk(el))=="transparent"){
|
||||
color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
|
||||
}
|
||||
else{
|
||||
|
|
@ -80,11 +80,11 @@ else{
|
|||
d.style.background=bk;
|
||||
d.className="niftycorners";
|
||||
p=getPadding(el,"Top");
|
||||
if(options.find("small")){
|
||||
if(strFind(options,"small")){
|
||||
d.style.marginBottom=(p-2)+"px";
|
||||
btype+="s"; lim=2;
|
||||
}
|
||||
else if(options.find("big")){
|
||||
else if(strFind(options,"big")){
|
||||
d.style.marginBottom=(p-10)+"px";
|
||||
btype+="b"; lim=8;
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ function AddBottom(el,side,options){
|
|||
var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;
|
||||
d.style.marginLeft="-"+getPadding(el,"Left")+"px";
|
||||
d.style.marginRight="-"+getPadding(el,"Right")+"px";
|
||||
if(options.find("alias") || (color=getBk(el))=="transparent"){
|
||||
if(strFind(options,"alias") || (color=getBk(el))=="transparent"){
|
||||
color="transparent";bk="transparent"; border=getParentBk(el);btype="t";
|
||||
}
|
||||
else{
|
||||
|
|
@ -108,11 +108,11 @@ else{
|
|||
d.style.background=bk;
|
||||
d.className="niftycorners";
|
||||
p=getPadding(el,"Bottom");
|
||||
if(options.find("small")){
|
||||
if(strFind(options,"small")){
|
||||
d.style.marginTop=(p-2)+"px";
|
||||
btype+="s"; lim=2;
|
||||
}
|
||||
else if(options.find("big")){
|
||||
else if(strFind(options,"big")){
|
||||
d.style.marginTop=(p-10)+"px";
|
||||
btype+="b"; lim=8;
|
||||
}
|
||||
|
|
@ -172,8 +172,8 @@ for(i=0;i<els.length;i++){
|
|||
|
||||
function getElementsBySelector(selector){
|
||||
var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c;
|
||||
if(selector.find("#")){ //id selector like "tag#id"
|
||||
if(selector.find(" ")){ //descendant selector like "tag#id tag"
|
||||
if(strFind(selector,"#")){ //id selector like "tag#id"
|
||||
if(strFind(selector," ")){ //descendant selector like "tag#id tag"
|
||||
s=selector.split(" ");
|
||||
var fs=s[0].split("#");
|
||||
if(fs.length==1) return(objlist);
|
||||
|
|
@ -195,11 +195,11 @@ if(selector.find("#")){ //id selector like "tag#id"
|
|||
}
|
||||
}
|
||||
}
|
||||
if(selector.find(".")){ //class selector like "tag.class"
|
||||
if(strFind(selector,".")){ //class selector like "tag.class"
|
||||
s=selector.split(".");
|
||||
tag=s[0];
|
||||
selclass=s[1];
|
||||
if(selclass.find(" ")){ //descendant selector like tag1.classname tag2
|
||||
if(strFind(selclass, " ")){ //descendant selector like tag1.classname tag2
|
||||
s=selclass.split(" ");
|
||||
selclass=s[0];
|
||||
tag2=s[1];
|
||||
|
|
@ -235,15 +235,15 @@ return(c);
|
|||
|
||||
function getBk(x){
|
||||
var c=getStyleProp(x,"backgroundColor");
|
||||
if(c==null || c=="transparent" || c.find("rgba(0, 0, 0, 0)"))
|
||||
if(c==null || c=="transparent" || strFind(c,"rgba(0, 0, 0, 0)"))
|
||||
return("transparent");
|
||||
if(c.find("rgb")) c=rgb2hex(c);
|
||||
if(strFind(c,"rgb")) c=rgb2hex(c);
|
||||
return(c);
|
||||
}
|
||||
|
||||
function getPadding(x,side){
|
||||
var p=getStyleProp(x,"padding"+side);
|
||||
if(p==null || !p.find("px")) return(0);
|
||||
if(p==null || !strFind(p, "px")) return(0);
|
||||
return(parseInt(p));
|
||||
}
|
||||
|
||||
|
|
@ -283,4 +283,4 @@ for(i=0;i<3;i++){
|
|||
if(r[i].length==1) r[i]="0"+r[i];
|
||||
}
|
||||
return("#"+r[0]+r[1]+r[2]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,8 +75,3 @@ Protoload = {
|
|||
_zIndex: 1000000*/
|
||||
};
|
||||
|
||||
if (Prototype) {
|
||||
Element.addMethods(Protoload);
|
||||
Object.extend(Element, Protoload);
|
||||
}
|
||||
/* */
|
||||
Loading…
Add table
Add a link
Reference in a new issue