mass tagger -> shm-*, specify what data tags shm-thumb has, now it works with all themes
This commit is contained in:
parent
6394cd8100
commit
887c746e35
@ -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 {
|
||||
|
@ -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 />');
|
||||
img.attr( "src", image_link+'/ext/mass_tagger/toggle.gif' );
|
||||
|
||||
var link = $('<a />');
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
@ -9,7 +9,7 @@ class MassTaggerTheme extends Themelet {
|
||||
$body = "
|
||||
<form action='".make_link("mass_tagger/tag")."' method='POST'>
|
||||
<input id='mass_tagger_activate' type='button' onclick='activate_mass_tagger(\"$data_href\");' value='Activate'/>
|
||||
<div id='mass_tagger_controls'>
|
||||
<div id='mass_tagger_controls' style='display: none;'>
|
||||
Click on images to mark them. Use the 'Index Options' in the Board Config to increase the amount of shown images.
|
||||
<br />
|
||||
<input type='hidden' name='ids' id='mass_tagger_ids' />
|
||||
|
Loading…
x
Reference in New Issue
Block a user