Tagger: 20070927 0150
git-svn-id: file:///home/shish/svn/shimmie2/trunk@495 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
27473f272a
commit
bc42c756b1
3 changed files with 85 additions and 17 deletions
|
@ -1,5 +1,25 @@
|
|||
function byId(id) {
|
||||
return document.getElementById(id);
|
||||
// Tagger JS
|
||||
// Original Code Author: Artanis (Erik Youngren <artanis.00@gmail.com>)
|
||||
// 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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,11 @@ class taggerTheme extends Themelet {
|
|||
$html = <<<EOD
|
||||
<span style="font-size:.7em;">Collapse this block to hide Tagger.</span>
|
||||
<br/>
|
||||
<a onclick="taggerResetPos();" style="cursor:pointer;">Default Location</a>
|
||||
<hr/>
|
||||
<a href='$url_more'>About Tagger</a>
|
||||
<div id="tagger_window" style="top:100px;left:100px;" onmousedown="setTagIndicators("tagger_window");">
|
||||
<div id="tagger_titlebar" title="'Drag to move" onmousedown="dragStart(event,"tagger_window");">
|
||||
<div id="tagger_window" style="bottom:25px;right:25px;" onmousedown="setTagIndicators();">
|
||||
<div id="tagger_titlebar" title="Drag to move" onmousedown="dragStart(event,"tagger_window");">
|
||||
Tagger
|
||||
</div>
|
||||
<div id="tagger_body" style="height:300px;">
|
||||
|
@ -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 = <<<EOD
|
||||
<ul>
|
||||
<li>Click the links to add the tag to the image's tag list, when done, press Set to save the tags.</li>
|
||||
<ul id="Tagger">
|
||||
<li>
|
||||
If you are having trouble finding the tag you are looking for, enter it into the box at the top.<br/>
|
||||
As you type, Tagger will remove tags that do not match to aid your search.<br/>
|
||||
If it is not in the list, click Add to add the tag to the image's tag list.<br/>
|
||||
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.
|
||||
<li>
|
||||
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.
|
||||
</li>
|
||||
<li>
|
||||
<p>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.</p>
|
||||
<p>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.</p>
|
||||
<p>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.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Tagger requires javascript for its functionality. Sorry, but there's no
|
||||
other way to accomplish the tag list modifications.</p>
|
||||
<p>If you have javascript completely disabled, you will not be able to use
|
||||
Tagger.</p>
|
||||
<p>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.</p>
|
||||
</li>
|
||||
</ul>
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue