diff --git a/contrib/tagger/script.js b/contrib/tagger/script.js index bc0c94c0..9b8b79ec 100644 --- a/contrib/tagger/script.js +++ b/contrib/tagger/script.js @@ -1,5 +1,25 @@ -function byId(id) { - return document.getElementById(id); +// Tagger JS +// Original Code Author: Artanis (Erik Youngren ) +// All other code copyright by their authors, see comments for details. + +// In case the drag point goes off screen. +function taggerResetPos() { + tagger = byId("tagger_window"); + + // reset default position (bottom right.) + tagger.style.top=""; + tagger.style.left=""; + tagger.style.right="25px"; + tagger.style.bottom="25px"; + + // get location in (left,top) terms + pos = findPos(tagger); + + // set top left and clear bottom right. + tagger.style.top = pos[1]+"px"; + tagger.style.left = pos[0]+"px"; + tagger.style.right=""; + tagger.style.bottom=""; } function tagExists(tag) { @@ -34,6 +54,8 @@ function toggleTag(tag) { tag_link.style.fontWeight = ""; } } + obj = byId("tagger_custTag"); + obj.focus(); } function addTagById(id) { @@ -41,12 +63,15 @@ function addTagById(id) { addTag(tag.value); } -function setTagIndicators(id) { - tagger = byId(id); - tagger.onclick = null; +function setTagIndicators() { + tagger = byId("tagger_window"); + // core.js took window.onload, so emulate it by using onclick and then + // removing the event. + tagger.setAttribute("onmousedown",""); + + taggerResetPos(); tags = byId("tags"); - tags = tags.value.split(" "); for (x in tags) { @@ -63,6 +88,7 @@ function tagger_filter(id) { var e; search = filter.value; + // set up single letter filters for first-letter matching only. if (search.length == 1) search = " "+search; @@ -70,6 +96,7 @@ function tagger_filter(id) { for (x in tag_links) { tag_id = tag_links[x].id; + // remove tagger_tag from id, prepend space for first-letter matching. tag = " "+tag_id.replace(/tagger_tag_/,""); e = byId(tag_id); if (!tag.match(search)) { @@ -106,6 +133,19 @@ function getElementsByTagNames(list,obj) { } return resultArray; } +// http://www.quirksmode.org/js/findpos.html // +function findPos(obj) { + var curleft = curtop = 0; + if (obj.offsetParent) { + curleft = obj.offsetLeft + curtop = obj.offsetTop + while (obj = obj.offsetParent) { + curleft += obj.offsetLeft + curtop += obj.offsetTop + } + } + return [curleft,curtop]; +} // End // // Drag Code // @@ -160,7 +200,6 @@ var dragObj = new Object(); dragObj.zIndex = 0; function dragStart(event, id) { - var el; var x, y; diff --git a/contrib/tagger/style.css b/contrib/tagger/style.css index 895602fa..1897ac4a 100644 --- a/contrib/tagger/style.css +++ b/contrib/tagger/style.css @@ -14,7 +14,9 @@ border:2px solid; border-bottom:1px solid; -moz-border-radius:10px 10px 0px 0px; + background-image:none; background-color:white; + cursor:move; } @@ -29,3 +31,8 @@ #tagger_body a { font-size:1.5em; } + +#Tagger li { + margin-bottom:1em; + width:20em; +} diff --git a/contrib/tagger/theme.php b/contrib/tagger/theme.php index bc1a302e..92bc4d43 100644 --- a/contrib/tagger/theme.php +++ b/contrib/tagger/theme.php @@ -16,9 +16,11 @@ class taggerTheme extends Themelet { $html = <<Collapse this block to hide Tagger.
+Default Location +
About Tagger -
-
+
+
Tagger
@@ -32,7 +34,7 @@ EOD; $page->add_block( new Block("Tagger", "".$html, "left", - 0)); + 50)); } public function trimTag($s,$len=80) { @@ -46,19 +48,39 @@ EOD; public function show_about ($event) { global $page; $html = << -
  • Click the links to add the tag to the image's tag list, when done, press Set to save the tags.
  • +
    • - If you are having trouble finding the tag you are looking for, enter it into the box at the top.
      - As you type, Tagger will remove tags that do not match to aid your search.
      - If it is not in the list, click Add to add the tag to the image's tag list.
      - Tags must have two uses to appear in Tagger's list, so you'll have to enter the tag at least once more. + If Tagger is in you way, click and drag it's title bar to move it to a + more convienient location. +
    • + Click the links to add the tag to the image's tag list, when done, press + Set (by the actual tag list) to save the tags. +
    • +
    • +

      Tagger gets all the tags in use with 2 or more uses, so the list can get + quite large. If you are having trouble finding the tag you are looking for, + you can enter it into the box at the top and as you type, Tagger will remove + tags that do not match to aid your search.

      +

      If the tag is not in the list, finish typing out the tag and click "Add" to + add the tag to the image's tag list.

      +

      Tags must have two uses to appear in Tagger's list, so you'll have to + enter the tag for at least one other image for it to show up.

      +
    • +
    • +

      Tagger requires javascript for its functionality. Sorry, but there's no + other way to accomplish the tag list modifications.

      +

      If you have javascript completely disabled, you will not be able to use + Tagger.

      +

      Due to the manner in which Tagger is constructed, it will hide along with + it's block on the side bar and block behaviour will remember that + setting in shimmie's cookies.

    EOD; $page->set_title("About Extension: Tagger"); $page->set_heading("About Extension: Tagger"); - $page->add_block( new Block("Author","Erik Youngren (Artanis) artanis.00@gmail.com","main",0)); + $page->add_block( new Block("Author", + "Artanis (Erik Youngren <artanis.00@gmail.com>)","main",0)); $page->add_block( new Block("Use", $html,"main",1)); } }