diff options
author | Shaun McCance <shaunm@gnome.org> | 2011-05-18 16:06:08 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2011-05-18 16:06:08 -0400 |
commit | 0637f921f36910d7688f73e14b2d2ec79ca90989 (patch) | |
tree | 90441f99ffbc4e2bcddd2d2826bf75f70040d594 /data/yelp.js | |
parent | ee830ed9af0b7d911a25bf26d62f115f7c842c43 (diff) | |
download | yelp-0637f921f36910d7688f73e14b2d2ec79ca90989.tar.gz |
Massive cleanup of old files
Diffstat (limited to 'data/yelp.js')
-rw-r--r-- | data/yelp.js | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/data/yelp.js b/data/yelp.js deleted file mode 100644 index 8cc6d5f0..00000000 --- a/data/yelp.js +++ /dev/null @@ -1,95 +0,0 @@ -var slt = { - /* Shorten the link trail by chopping off links from the - beginning of it until it's no longer wider than the screen */ - init: function() { - slt.lt = document.getElementById('linktrail'); - if (!slt.lt) return; - - /* Try and add links, in case we've just resized the - window to be bigger */ - var canContinue = true; - while (canContinue && - (slt.findRightEdge() < document.body.offsetWidth)) { - canContinue = slt.addLinktrailElement(); - } - - /* Now remove links until the linktrail is narrower than - the window */ - canContinue = true; - while (canContinue && - (slt.findRightEdge() > document.body.offsetWidth)) { - canContinue = slt.removeLinktrailElement(); - } - }, - - findRightEdge: function() { - /* get the position of the far right-hand-edge of the rightmost - element in the linktrail */ - var maxright = 0; - - for (var i=0;i<slt.lt.childNodes.length;i++) { - if (typeof slt.lt.childNodes[i].offsetLeft != 'undefined' && - typeof slt.lt.childNodes[i].offsetWidth != 'undefined') { - var rightedge = slt.lt.childNodes[i].offsetLeft + - slt.lt.childNodes[i].offsetWidth; - if (rightedge > maxright) maxright = rightedge; - } - } - - return maxright; - }, - - removeLinktrailElement: function() { - /* Walk through the link trail until we find a complete - link; when we do, change its displayed text to "…", - put its actual text in a tooltip, and return */ - var links = slt.lt.getElementsByTagName('a'); - - for (var i=0;i<links.length;i++) { - if (links[i].firstChild) { - if (links[i].firstChild.nodeValue != '…') { - links[i].title = links[i].firstChild.nodeValue; - links[i].firstChild.nodeValue = '…'; - return true; - } - } - } - - /* There are no links left to remove; indicate this back - to the caller so it doesn't loop infinitely */ - return false; - }, - - addLinktrailElement: function() { - /* Walk through the link trail until we find a "…" - link; when we do, change its displayed text back to - what it should be and return */ - var links = slt.lt.getElementsByTagName('a'); - - for (var i=0;i<links.length;i++) { - if (links[i].firstChild) { - if (links[i].firstChild.nodeValue == '…') { - links[i].firstChild.nodeValue = links[i].title; - return true; - } - } - } - - /* There are no links left to add; indicate this back - to the caller so it doesn't loop infinitely */ - return false; - } -} - -/* addEventListener() is Gecko-only, but so is yelp */ -window.addEventListener("load",slt.init,false); -/* load doesn't seem to get fired in Yelp. I might need to tell Gecko - that I'm finished or something. DOMContentLoaded works though */ -window.addEventListener("DOMContentLoaded",slt.init,false); -window.addEventListener("resize",slt.init,false); - -function submit_search () -{ - window.location = "x-yelp-search:" + document.getElementById ('search-entry').value; - return false; -} |