User:Najevi/global.js

/* == Modify certain element's inline styles at widget dashboard to resemble MyHome column layout == enabler for a Wikia-wide myLZ $( function {   $('.widget_dashboard #sidebar_3').css({'min-width':'330px','width':'65%'});    $('.widget_dashboard #sidebar_4').css({'min-width':'330px','width':'33%'});    //$('.widget_dashboard #sidebar_5').css({'width':'206px'}); // i.e. no change });

/* Hide any WikiPage widgets that cannot be found at the current wiki community. See also: w:c:messaging:MediaWiki:Widgetwikipagemissing

$( function {   $('.WidgetWikiPage i:contains("failed to load")').each(function{ $this.closest('dl .WidgetWikiPage').css({'display':'none'}) }); }); jQuery(document).ready( function {   jQuery('.WidgetWikiPage i:contains("failed to load")').closest('dl .WidgetWikiPage').css({'display':'none'}); }); $( function {   $('.WidgetWikiPage dl:contains("failed to load")').css({'display':'none'}); }); $( function {   $('dl .WidgetWikiPage i:contains("failed to load")').closest('dl .WidgetWikiPage').css({'display':'none'}); }); $( function {   $('.widget_sidebar dl .WidgetWikiPage i:contains("failed to load")').parent('dl .WidgetWikiPage').hide; }); $( function {   $('div .widget_sidebar i:contains("failed to load")').parent('.WidgetWikiPage').hide; }); $( function {   $('div .widget_sidebar dl .WidgetWikiPage i:contains("failed to load")').closest('dl').hide; }); $( function {   $('div .widget_sidebar dl .WidgetWikiPage dd p i:contains("failed to load")').parent('p').parent('dd').parent('dl').hide; }); $( function {   $('div .widget_sidebar').css({'background-color':'red'}); // OK }); $( function {   $('div .widget_sidebar dl .WidgetWikiPage').css({'background-color':'red'}); // NOT OK }); $( function {   $('div .widget_sidebar .WidgetWikiPage').css({'background-color':'red'}); // NOT OK }); $( function {   $('dl .WidgetWikiPage').css({'background-color':'red'}); // NOT OK }); $( function {   $('.WidgetWikiPage').css({'background-color':'red'}); // == OK == }); $( function {   $('.WidgetWikiPage i:contains("failed to load")').closest('.WidgetWikiPage').css({'background-color':'cyan'}); // NOT OK }); $( function {   $('.WidgetWikiPage i:contains("failed to load")').css({'background-color':'cyan'}); // == OK == }); $( function {   $('.WidgetWikiPage i:contains("failed to load")').parent('p').parent('dd').css({'background-color':'red'}); // == OK == }); $( function {   $('.WidgetWikiPage i:contains("failed to load")').parent('p').parent('dd').parent('dl').css({'background-color':'cyan'}); // == OK == }); $( function {   $('.WidgetWikiPage i:contains("failed to load")').closest('dl').css({'background-color':'red'}); //   NOT OK   behaves like DL element never selected }); $( function {   $('.WidgetWikiPage i:contains("failed to load")').closest('dl').parent('dl').css({'background-color':'red'}); //   NOT OK   behaves like DL element never selected }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load")').closest('dl').css({'background-color':'red'}); //   NOT OK   behaves like DL element never selected }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load")').closest('dl').parent('dl').css({'background-color':'red'}); //  NOT OK }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load")').closest('dl').hide; // NOT OK }); $( function {   $('.WidgetWikiPage i:contains("failed to load")').parent('p').parent('dd').parent('dl').hide; // == PERFECT == }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load"):closest("dl")').css({'background-color':'red'}); // NOT OK - behaves like only P selected }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load")').parents('dl .WidgetWikiPage').css({'background-color':'red'}); // NOT OK - nothing selected }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load")').parents('.WidgetWikiPage').css({'background-color':'red'}); // == PERFECT == }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load")').parents('dl.WidgetWikiPage').css({'background-color':'cyan'}); // NOT OK - nothing selected }); $( function {   $('#widget_sidebar .WidgetWikiPage i:contains("failed to load")').closest('dd').parent('dl').css({'background-color':'red'}); //  == PERFECT == BEST == });

$( function {   $('.WidgetWikiPage i:contains("failed to load")').closest('dd').parent('dl').hide; //  == PERFECT == BEST == works at Dashboard also });

/*  Custom edit buttons -- http://www.wikia.com/wiki/Help:Custom_edit_buttons -- if (mwCustomEditButtons) { mwCustomEditButtons.push({       "imageFile": "http://images2.wikia.nocookie.net/central/images/1/12/Button_gallery.png",        "speedTip": "Gallery of images",        "tagOpen": "\n",        "sampleText": "File:ExampleA.jpg|Caption1\nImage:ExampleB.jpg|Caption2"    }); mwCustomEditButtons.push({       "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",        "speedTip": "Footnote reference",        "tagOpen": " ",        "sampleText": "Insert footnote text"    }); mwCustomEditButtons.push({       "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/7f/Button_link_to_Wikipedia.png",        "speedTip": "Wikipedia link",        "tagOpen": "Wikipedia:",        "tagClose": "",        "sampleText": "insert pagename"    }); mwCustomEditButtons.push({       "imageFile": "http://images3.wikia.nocookie.net/central/images/4/4a/Button_table.png",        "speedTip": "Wiki table",        "tagOpen": '{| class="wikitable"\n|',        "tagClose": "\n|}",        "sampleText": "-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"    }); mwCustomEditButtons.push({       "imageFile": "http://images3.wikia.nocookie.net/central/images/e/e3/WikiTable.PNG",        "speedTip": "Collapsible content",        "tagOpen": '  ',        "tagClose": "  ",        "sampleText": "insert collapsible content"    }); mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png", "speedTip": "Underline", "tagOpen": ' ', "tagClose": ' ', "sampleText": "insert text" };

mwCustomEditButtons.push({       "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",        "speedTip": "Strike-through",        "tagOpen": " ",        "tagClose": " ",        "sampleText": "insert text"    }); mwCustomEditButtons.push({       "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",        "speedTip": "Superscript",        "tagOpen": " ",        "tagClose": " ",        "sampleText": "insert text"    }); mwCustomEditButtons.push({       "imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",        "speedTip": "Subscript",        "tagOpen": " ",        "tagClose": " ",        "sampleText": "insert text"    }); mwCustomEditButtons.push({       "imageFile": "http://images1.wikia.nocookie.net/central/images/5/58/Button_small.png",        "speedTip": "Small",        "tagOpen": " ",        "tagClose": " ",        "sampleText": "insert text"    }); mwCustomEditButtons.push({       "imageFile": "http://images2.wikia.nocookie.net/central/images/5/56/Button_big.png",        "speedTip": "Big",        "tagOpen": " ",        "tagClose": " ",        "sampleText": "insert text"    }); mwCustomEditButtons.push({        "imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",        "speedTip": "Line break",        "tagOpen": " ",        "tagClose": "",        "sampleText": ""    }); mwCustomEditButtons.push({       "imageFile": "http://images2.wikia.nocookie.net/central/images/f/f6/Button_html_comment.png",        "speedTip": "HTML Comment",        "tagOpen": "",        "sampleText": "insert comment"    }); mwCustomEditButtons.push({       "imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",        "speedTip": "Quotation-block",        "tagOpen": " \n",        "tagClose": "\n ",        "sampleText": "insert text"    }); }

/* end custom edit buttons */