From 887c746e3562be0b7d46dcadd3aec9616e9567bd Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 15 Aug 2012 21:05:08 +0100 Subject: [PATCH] mass tagger -> shm-*, specify what data tags shm-thumb has, now it works with all themes --- ext/mass_tagger/main.php | 2 - ext/mass_tagger/script.js | 79 ++++++++++++++------------------------- ext/mass_tagger/style.css | 8 ---- ext/mass_tagger/theme.php | 2 +- 4 files changed, 29 insertions(+), 62 deletions(-) delete mode 100644 ext/mass_tagger/style.css diff --git a/ext/mass_tagger/main.php b/ext/mass_tagger/main.php index ff3d91d7..7170dae8 100644 --- a/ext/mass_tagger/main.php +++ b/ext/mass_tagger/main.php @@ -10,8 +10,6 @@ * add buttons to each image to mark them for tagging, and a field for * inputting tags will appear. Once the "Tag" button is clicked, the tags in * the text field will be added to marked images. - * - * As of now only compatible with the lite theme. */ class MassTagger extends Extension { diff --git a/ext/mass_tagger/script.js b/ext/mass_tagger/script.js index 6b8ae791..1cc4077c 100644 --- a/ext/mass_tagger/script.js +++ b/ext/mass_tagger/script.js @@ -1,57 +1,34 @@ +function activate_mass_tagger ( image_link ) { + $(".shm-thumb").each( + function ( index, block ) { + add_mass_tag_button( $(block), image_link ); + } + ); + $('#mass_tagger_controls').show(); + $('#mass_tagger_activate').hide(); +} + +function add_mass_tag_button($block, image_link) { + + var c = function() { toggle_tag(this, $block.data("post-id")); return false; }; + + $block.find("A").click(c); + $block.click(c); // sometimes the thumbs *is* the A +} + function toggle_tag( button, id ) { id += ":"; var list = $('#mass_tagger_ids'); var string = list.val(); - if( string.indexOf( id ) > -1 ) return remove_mass_tag_id( button, list, id, string ); - - return add_mass_tag_id( button, list, id, string ); -} - -function add_mass_tag_id( button, list, id, string ) { - $(button).attr( 'style', 'display:block;border: 3px solid blue;' ); - string += id; - list.val( string ); - return false; -} - -function remove_mass_tag_id( button, list, id, string ) { - $(button).attr( 'style', '' ); - string = string.replace( id, '' ); - list.val( string ); - return false; -} - -function activate_mass_tagger ( image_link ) { - $(".shm-thumb").each( - function ( index, block ) { - add_mass_tag_button( block, image_link ); - } - ); - $('#mass_tagger_controls').show(); - $('#mass_tagger_activate').hide(); - return false; -} - -function add_mass_tag_button ( block, image_link ) { - var id = $(block).data("post-id"); - - var button = create_mass_tag_button( id, image_link ); - $(block).append( button ); - - return; -} - -function create_mass_tag_button ( id, image_link ) { - var img = $(''); - img.attr( "src", image_link+'/ext/mass_tagger/toggle.gif' ); - - var link = $(''); - link.attr("class",'zoom'); - link.attr("onclick",'return toggle_tag( this, "'+id+'")'); - link.attr("href",'#'); - - link.append( img ); - - return link; + if( string.indexOf( id ) > -1 ) { + $(button).css('border', 'none'); + string = string.replace(id, ''); + list.val(string); + } + else { + $(button).css('border', '3px solid blue'); + string += id; + list.val(string); + } } diff --git a/ext/mass_tagger/style.css b/ext/mass_tagger/style.css deleted file mode 100644 index 13467ae1..00000000 --- a/ext/mass_tagger/style.css +++ /dev/null @@ -1,8 +0,0 @@ - -.zoom{ position:absolute;display:none;margin:-110px 27px; } -.thumbblock:hover .zoom{ display:block; } -.zoom:hover{ border: 3px solid blue; } -/*.zoom img:hover{ background:url(/contrib/simpletest/data/pbx_screenshot.jpg) no-repeat;}*/ - -.zoom img { width: 100px; height: 100px; } -#mass_tagger_controls { display:none; } diff --git a/ext/mass_tagger/theme.php b/ext/mass_tagger/theme.php index 28197b3e..0f0b009e 100644 --- a/ext/mass_tagger/theme.php +++ b/ext/mass_tagger/theme.php @@ -9,7 +9,7 @@ class MassTaggerTheme extends Themelet { $body = "
-
+