To get updates on new site content, like us on Facebook or follow us on Twitter.

Difference between revisions of "MediaWiki:Common.js"

From JFA Wiki
(Replaced content with "Any JavaScript here will be loaded for all users on every page load.: /*Insert 'Justice for Animals .org' in the DOM, for the header jQuery(document).ready(function...")
(Tag: Replaced)
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
  
//Insert 'Justice for Animals .org' in the DOM, for the header
+
/*Insert 'Justice for Animals .org' in the DOM, for the header
 
jQuery(document).ready(function () {
 
jQuery(document).ready(function () {
 
document.body.insertAdjacentHTML( 'afterbegin', '<div id="jfatitle"><a href="/Main_Page">Justice for Animals .org</a></div>');
 
document.body.insertAdjacentHTML( 'afterbegin', '<div id="jfatitle"><a href="/Main_Page">Justice for Animals .org</a></div>');
Line 7: Line 7:
 
 
 
})
 
})
 
+
*/
 
 
// Outline functionality: supports only one outline per page
 
jQuery(document).ready(function () {
 
 
 
    jQuery('.outline-wrapper li p').replaceWith(function () {
 
        return this.innerHTML;
 
    });
 
 
 
    jQuery(".total-wrapper").each(function (index) {
 
 
 
        jQuery(this).find('.outline-wrapper li').addClass('folding-terminal');
 
 
 
        jQuery(this).find('.outline-wrapper li:has(ul)')
 
            .addClass('folding-link plusbox')
 
            .removeClass('folding-terminal')
 
 
 
            .click(function (event) {
 
 
 
 
 
                //console.log(this);
 
                //console.log(event.target);
 
 
 
 
 
                if (this == event.target) {
 
 
 
                    if (jQuery(this).children().is(':hidden')) {
 
                        jQuery(this).addClass('minusbox').removeClass('plusbox');
 
                    } else {
 
                        jQuery(this).addClass('plusbox').removeClass('minusbox')
 
                    }
 
 
 
                    jQuery(this).children().toggle();
 
                }
 
            })
 
            .children().hide();
 
        /* this has gotta come after li clixk in the chain */
 
 
 
        var this_total_wrapper = this;
 
 
 
        jQuery(this).find('.outline-expand-all')
 
 
 
            .click(function (event) {
 
 
 
                jQuery(this_total_wrapper).find('.outline-wrapper li').show();
 
                jQuery(this_total_wrapper).find('.outline-wrapper li:has(ul)').children().show();
 
 
 
 
 
                jQuery(this_total_wrapper).find('.outline-wrapper li:has(ul)')
 
                    .addClass('minusbox')
 
                    .removeClass('plusbox');
 
                return false;
 
            });
 
 
 
        jQuery(this).find('.outline-collapse-all')
 
 
 
            .click(function (event) {
 
 
 
                jQuery(this_total_wrapper).find('.outline-wrapper li').show();
 
                jQuery(this_total_wrapper).find('.outline-wrapper li:has(ul)').children().hide();
 
 
 
                jQuery(this_total_wrapper).find('.outline-wrapper li:has(ul)')
 
                    .addClass('plusbox')
 
                    .removeClass('minusbox');
 
 
 
                jQuery(this_total_wrapper).find('.outline-wrapper li').hide();
 
 
 
                return false;
 
            });
 
 
 
        jQuery(this).find('.outline-title')
 
 
 
            .click(function (event) {
 
 
 
                jQuery(this_total_wrapper).find('.outline-wrapper li').show();
 
                jQuery(this_total_wrapper).find('.outline-wrapper li:has(ul)').children().hide();
 
 
 
                jQuery(this_total_wrapper).find('.outline-wrapper li:has(ul)')
 
                    .addClass('plusbox')
 
                    .removeClass('minusbox');
 
                return false;
 
            });
 
 
 
 
 
 
 
    });
 
 
 
 
 
    // classify special nodes so they can be styled independently
 
    jQuery(".outline-wrapper li").each(function (index, value) {
 
 
 
        if ('Context'.indexOf(value.firstChild.data.trim()) >= 0 ||
 
            'Meta'.indexOf(value.firstChild.data.trim()) >= 0 ||
 
            'Source'.indexOf(value.firstChild.data.trim()) >= 0 ||
 
            'Extra'.indexOf(value.firstChild.data.trim()) >= 0) {
 
                jQuery(this).addClass('outline-special-node');
 
        }
 
    });
 
 
 
 
 
});
 
 
 
 
 
function old_junk() {
 
 
 
    jQuery('.outline-title').click(function () {
 
 
 
        jQuery('.outline-wrapper li:has(ul)').hide();
 
        //jQuery('.outline-wrapper li').addClass('folding-terminal');
 
        jQuery('.outline-wrapper li:has(ul)')
 
            .addClass('plusbox')
 
            .removeClass('minusbox');
 
        return false;
 
    });
 
 
 
 
 
    jQuery('.outline-collapse-all').click(function () {
 
        collapse_all();
 
        return false;
 
    });
 
 
 
    jQuery('.outline-expand-all').click(function () {
 
        expand_all();
 
        return false;
 
    });
 
 
 
    function collapse_all() {
 
        jQuery('.outline-wrapper li:has(ul)').children().hide();
 
        //jQuery('.outline-wrapper li').addClass('folding-terminal');
 
        jQuery('.outline-wrapper li:has(ul)')
 
            .addClass('plusbox')
 
            .removeClass('minusbox');
 
    }
 
 
 
    function expand_all() {
 
        jQuery('.outline-wrapper li:has(ul)').children().show();
 
        //jQuery('.outline-wrapper li').addClass('folding-terminal');
 
        jQuery('.outline-wrapper li:has(ul)')
 
            .addClass('minusbox')
 
            .removeClass('plusbox')
 
    }
 
 
 
 
 
}
 

Revision as of 07:47, 6 February 2019

/* Any JavaScript here will be loaded for all users on every page load. */

/*Insert 'Justice for Animals .org' in the DOM, for the header jQuery(document).ready(function () {

document.body.insertAdjacentHTML( 'afterbegin', '

<a href="/Main_Page">Justice for Animals .org</a>

');


})

  • /