Skip to main content
deleted 92 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

HTML/javascript review, optimization suggestions? Allowing simplified browsing of websites with a predictable URL structure

The code below has been a pet project of mine for some time, it. It allows simplified browsing of websites that have a predictable urlURL structure. Namely, namely TGP websites. Anyways, it

It has been greatly modified from it's original version to be effective on androidAndroid, and there is probably allotalot of room to improve on it. I'm not asking anyone to do my work for me but if you have some free time any criticisms or suggestions would be greatly appreciated, though.

HTML/javascript review, optimization suggestions?

The code below has been a pet project of mine for some time, it allows simplified browsing of websites that have a predictable url structure. Namely TGP websites. Anyways, it has been greatly modified from it's original version to be effective on android, and there is probably allot of room to improve on it. I'm not asking anyone to do my work for me but if you have some free time any criticisms or suggestions would be greatly appreciated.

Allowing simplified browsing of websites with a predictable URL structure

The code below has been a pet project of mine for some time. It allows simplified browsing of websites that have a predictable URL structure, namely TGP websites.

It has been greatly modified from it's original version to be effective on Android, and there is probably alot of room to improve on it. I'm not asking anyone to do my work for me, though.

Tweeted twitter.com/#!/StackCodeReview/status/168160156419506176
Source Link
JoeD
  • 31
  • 1

HTML/javascript review, optimization suggestions?

The code below has been a pet project of mine for some time, it allows simplified browsing of websites that have a predictable url structure. Namely TGP websites. Anyways, it has been greatly modified from it's original version to be effective on android, and there is probably allot of room to improve on it. I'm not asking anyone to do my work for me but if you have some free time any criticisms or suggestions would be greatly appreciated.

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
  <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-Equiv="Cache-Control" Content="no-cache">
<meta http-Equiv="Pragma" Content="no-cache">
<meta http-Equiv="Expires" Content="0">
<script type="text/javascript">

window.onload = function() {
   if(location.href.lastIndexOf('?')>0)(splitURL(location.href.substring(location.href.lastIndexOf('?')+1)))
   BROWSEbar.style.display='none'; 
     EDITbar.style.display='block';
};

window.onscroll = function() {
  document.getElementById('fixdiv').style.top =
     (window.pageYOffset) + 'px';
};

function splitURL(newURL)
{
EDITbar.fullURL.value=newURL;
EDITbar.splitURL.click();
EDITbar.goURL.click();
}

function combine(a,b,c,d,e,f,g){return a+b+c+d+e+f+g;}
function highlight(field) {field.focus();field.select();}

function minusone(a)
{
    b = a.length;
    a = Number(a);
    a = ((a > 1) ? a - 1 : a);
    a = String(a);
    while(a.length < b) 
    {
        a = "0" + a;
    }
    return a;
}

function plusone(a)
{
    b = a.length;
    a = Number(a);
    a++;
    a = String(a);
    while(a.length < b) 
    {
        a = "0" + a;
    }
    return a;
}

function gotoURL(sURL)
{
    var iTail=Math.round(Math.random()*100000);
    if (sURL.search('http://')<0){sURL="http://"+sURL;}
    sURL=sURL+'?r+'+iTail;
    top.frames['mframe'].location.href=sURL;
}

function URLsplit() 
{
    var newURL = EDITbar.fullURL.value.replace('http://','');
    var testI=null;
    var i=0;
    var j=1;
    EDITbar.clearURL.click();
    while (i<newURL.length)
    {
        switch(j)
        {
            case 1:
                EDITbar.url2.value = EDITbar.url2.value + newURL.charAt(i);
                if(testI == false){j++;}
                break;
            case 2:
                EDITbar.url3.value = EDITbar.url3.value + newURL.charAt(i);
                if(testI == true){j++;}
                break;
            case 3:
                EDITbar.url4.value = EDITbar.url4.value + newURL.charAt(i);
                if(testI == false){j++;}
                break;
            case 4:
                EDITbar.url5.value = EDITbar.url5.value + newURL.charAt(i);
                if(testI == true){j++;}
                break;
            case 5:
                EDITbar.url6.value = EDITbar.url6.value + newURL.charAt(i);
                if(newURL.charAt(i+1) == "."){j++;}
                break;
            case 6:
                EDITbar.url7.value = EDITbar.url7.value + newURL.charAt(i);
                break;
        }
        i++;
        testI = isNaN(newURL.charAt(i+1));
    }
    BROWSEbar.url3.value=EDITbar.url3.value;
  BROWSEbar.url5.value=EDITbar.url5.value;
}
</script>

<title>
   Filter-Kilter Browser
</title>

<style type="text/css">

#fixdiv {filter: alpha(opacity=86); -moz-opacity: .86; background-color:#EEE;}


html, body { margin: 0; padding: 0; height: 100%; overflow:hidden;}
    p, h1 {top-margin: 0; padding: 0;}
    .button 
    {
          color: #900;
      border: 1px solid #900;
      font-size: 24px;
      font-weight: bold;
    }
    .browse 
    {
          color: #862;
      border: 2px solid #806020;
      font-size: 240%;
      font-weight: 900;
    }
        iframe 
    {
          position: absolute;
          top: 0; left: 0; width: 100%; height: 100%;
          border: none;
        }
    table,th,td
    {
      border-collapse : collapse;
      padding:0;
    }
    th
    {
      background-color:green;
      color:white;
    }

input.groovybutton
{
   font-size:46px;
   font-family:Comic Sans MS,sans-serif;
   font-weight:bold;
   color:#ffffff;
   width:990px;
   height120px;
   background-color:#800;
   border-style:solid;
   border-color:#000000;
}
input.smallbtn
{
   font-size:24px;
   font-family:Comic Sans MS,sans-serif;
   font-weight:bold;
   color:#ffffff;
   width:100px;
   height60px;
   background-color:#800;
   border-style:solid;
   border-color:#000000;
}
input.medbtn
{
   font-size:36px;
   font-family:Comic Sans MS,sans-serif;
   font-weight:bold;
   color:#fff;
   width:100px;
   height80px;
   background-color:#f60;
   border-style:solid;
   border-color:#000000;
}
input.medtxt
{
   font-size:50px;
   font-family:Comic Sans MS,sans-serif;
   font-weight:bold;
   color:#000000;
   width:100px;
   background-color:#FFF0D0;
   border-style:solid;
   border-color:#000000;
}
input.bigtxt
{
   font-size:38px;
   font-weight:bold;
   color:#800;
   height60px;
   background-color:#ffffff;
   border-style:solid;
   border-color:#800;
}

</style>


</head>

<body>

<iframe id="mframe" name="mframe" src="MAIN.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"></iframe>

<div id="fixdiv" style="background-color: transparent; position: absolute; z-index: 1; visibility: show; left: 10%;">
<center>
<form name=EDITbar method=get action="javascript:gotoURL(EDITbar.fullURL.value);" onsubmit="EDITbar.fullURL.value=combine(url1.value,url2.value,url3.value,url4.value,url5.value,url6.value,url7.value);">
<input class='smallbtn' name=clearURL type=reset value="CLEAR">
<input class='bigtxt' name=fullURL type=text size=40>
<input class='smallbtn' name=splitURL type=submit value="SPLIT" onclick="javaScript:URLsplit();">
<br>
<input class='button' name=url1 type=text size=4 value="http://" onkeyup="url1.value=('http://');">
<input class='button' name=url2 type=text size=20 value="">
<input class='button' name=url3 type=text size=4 value="">
<input class='button' name=url4 type=text size=12 value="">
<input class='button' name=url5 type=text size=4 value="">
<input class='button' name=url6 type=text size=9 value="">
<input class='button' name=url7 type=text size=4 value="">
<br>
<input class='groovybutton' name=cancelURL type=submit value="BROWSE" onclick="BROWSEbar.url3.value=url3.value; BROWSEbar.url5.value=url5.value; EDITbar.style.display='none'; BROWSEbar.style.display='block';">

</form>

<form name=BROWSEbar method=get action="javascript:gotoURL(EDITbar.fullURL.value);" onsubmit="EDITbar.fullURL.value=combine(EDITbar.url1.value,EDITbar.url2.value,EDITbar.url3.value,EDITbar.url4.value,EDITbar.url5.value,EDITbar.url6.value,EDITbar.url7.value);">
<input class='medbtn' name=minus1 type=submit value="-" onClick="url3.value=minusone(url3.value);EDITbar.url3.value=url3.value;">
<input class='medtxt' name=url3 type=text size=42 value="">
<input class='medbtn' name=add1 type=submit value="+" onClick="url3.value=plusone(url3.value);EDITbar.url3.value=url3.value;">
<input class='medbtn' name=editURL type=button value="EDIT" onmouseover="BROWSEbar.style.display='none'; EDITbar.style.display='block';">
<input class='medbtn' name=minus2 type=submit value="-" onClick="url5.value=minusone(url5.value);EDITbar.url5.value=url5.value;">
<input class='medtxt' name=url5 type=text size=6 value="">
<input class='medbtn' name=add2 type=submit value="+" onClick="url5.value=plusone(url5.value);EDITbar.url5.value=url5.value;">
</form>

</center>
</div>

</body>

</html>