WordPress.org

Ready to get started?Download WordPress

Forums

IWG Faster Tagging
[resolved] Update for WP 3.0.1 (1 post)

  1. grapepress
    Member
    Posted 3 years ago #

    For any who are still using this plugin (like myself), here is an update to the Javascript code to make it work with WP 3.0.1.

    Copy and paste all of the below into your iwg_faster_tagging.js file, replacing all of the original code.

    /*
        This file is part of the "iwg faster tagging" plugin for wordpress
        Copyright (C) 2008 Thomas Schneider
        http://www.im-web-gefunden.de/
     */
    function iwg_addTag(clickedTag){
        //alert(clickedTag);//for debugging
        //var current_tags = jQuery.trim(jQuery('#tags-input').val()); ORIGINAL, changed is below
        var current_tags = jQuery.trim(jQuery('textarea[name="tax_input[post_tag]"]').val());
        //alert(current_tags);//for debugging
        current_tags = current_tags.replace(/(\s{0,},\s{0,})/g, ',');
        //alert(current_tags);//for debugging
        var re = new RegExp(clickedTag);
        if (!current_tags.match(re)) {
            if (current_tags.length > 0) {
                current_tags += ",";
            }
            current_tags += clickedTag;
            current_tags = current_tags.replace(/(\s{0,},\s{0,})/g, ', ');
            //alert(current_tags);//for debugging
            //jQuery('#tags-input').val(current_tags); ORIGINAL, changed is below
            jQuery('textarea[name="tax_input[post_tag]"]').val(current_tags);
        }
        //alert('alert1');//for debugging
        iwg_tag_update_quickclicks();
        return false;
    };
    
    function iwg_tag_update_quickclicks(){
        //var current_tags = jQuery.trim(jQuery('#tags-input').val());  ORIGINAL, changed is below
        var current_tags = jQuery.trim(jQuery('textarea[name="tax_input[post_tag]"]').val());
        current_tags = current_tags.replace(/(\s{0,},\s{0,})/g, ',');
        var current_tags_arr = current_tags.split(',');
        current_tags_arr = current_tags_arr.sort(function(a, b){
            a = jQuery.trim(a.toUpperCase());
            b = jQuery.trim(b.toUpperCase());
            return (a == b) ? 0 : (a > b) ? 1 : -1;
        });
        //jQuery('#tagchecklist').empty(); ORIGINAL, changed below
        jQuery('.tagchecklist').empty();
        shown = false;
        jQuery.each(current_tags_arr, function(key, val){
            val = jQuery.trim(val);
            if (!val.match(/^\s+$/) && '' != val) {
                //txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';  ORIGINAL, changed below
                txt = '<span><a id="post_tag-check-num-' + key + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
                //jQuery('#tagchecklist').append(txt); ORIGINAL, changed below
                jQuery('.tagchecklist').append(txt);
                //jQuery('#tag-check-' + key).click(new_tag_remove_tag); ORIGINAL, changed below
                //jQuery('#post_tag-check-num-' + key).click(new_tag_remove_tag); //had to change for 2.9.1
                jQuery('#post_tag-check-num-' + key).click(function(){tagBox.parseTags(this)});
                shown = true;
            }
        });
        if (shown) {
            //jQuery('#tagchecklist').prepend('<strong>' + postL10n.tagsUsed + '</strong><br />'); ORIGINAL, changed below
            jQuery('.tagchecklist').prepend('<strong>' + postL10n.tagsUsed + '</strong><br />');
            current_tags = jQuery.trim(current_tags_arr.join(','));
            current_tags = current_tags.replace(/(\s{0,},\s{0,})/g, ', ');
            //jQuery('#tags-input').val(current_tags); ORIGINAL, changed is below
            jQuery('textarea[name="tax_input[post_tag]"]').val(current_tags);
        }
            //alert('alert2');//for debugging
            return false;
    }

    http://wordpress.org/extend/plugins/iwg-faster-tagging/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic