Difference between revisions 137906 and 140991 on testwiki/// mw:User:PerfektesChaos/js/paneMarker/?.js /// 2012-06-198-20 [email protected] /// Fingerprint: #0#0#⏎ // Mark browser panes (tabbed or window) if particular action taken. // Try to exchange wiki-favicon for a red one if editing a wiki page. // Insert indicating character before document title. ⏎ ⏎ // Requires: JavaScript 1.3 // MediaWiki 1.18 (mw.libs, jQuery core) /// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA) /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; * if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html */ /* What links here: Global usage [[File:Apple-touch-icon-red-commons.png]] [[File:Apple-touch-icon-red-mediawiki.png]] [[File:Apple-touch-icon-red-wikinews.png]] [[File:Apple-touch-icon-red-wikipedia.png]] [[File:Apple-touch-icon-red-wiktionary.png]] [[File:Apple-touch-icon-red-wmf.png]] [[File:Favicon-red-commons.png]] [[File:Favicon-red-mediawiki.png]] [[File:Favicon-red-meta.png]] [[File:Favicon-red-testwiki.png]] [[File:Favicon-red-wikibooks.png]] [[File:Favicon-red-wikinews.png]] [[File:Favicon-red-wikipedia.png]] [[File:Favicon-red-wikiquote.png]] [[File:Favicon-red-wikisource.png]] [[File:Favicon-red-wikiversity.png]] [[File:Favicon-red-wmf.png]] */User defined changes of page title and favicon. // ResourceLoader: compatible; dependencies: user, mediawiki.util /// Fingerprint: #0#0# /// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA) /// <nowiki> /* jshint curly:true, eqeqeq:true, undef:true, white:false */ /* global document: true, jQuery: true, mediaWiki: true, window: true */ /*jslint plusplus: true, white: true */ /*globals document: true, jQuery: true, mediaWiki: true, window: true */ ( function ( mw, $ ) { "use strict"; if ( typeof mw.libs.paneMarker !== "object" ) { mw.libs.paneMarker = { opt: { } }; } mw.libs.paneMarker.vsn = -1.432; mw.libs.paneMarker.heads = "|dewiki|"; // +"|testwiki|"; mw.libs.paneMarker.type = "paneMarker"; /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; * if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html */ /* What links here: Global usage [[File:Apple-touch-icon-red-commons.png]] [[File:Apple-touch-icon-red-mediawiki.png]] [[File:Apple-touch-icon-red-wikinews.png]] [[File:Apple-touch-icon-red-wikipedia.png]] [[File:Apple-touch-icon-red-wiktionary.png]] [[File:Apple-touch-icon-red-wmf.png]] [[File:Favicon-red-commons.png]] [[File:Favicon-red-mediawiki.png]] [[File:Favicon-red-meta.png]] [[File:Favicon-red-testwiki.png]] [[File:Favicon-red-wikibooks.png]] [[File:Favicon-red-wikinews.png]] [[File:Favicon-red-wikipedia.png]] [[File:Favicon-red-wikiquote.png]] [[File:Favicon-red-wikisource.png]] [[File:Favicon-red-wikiversity.png]] [[File:Favicon-red-wmf.png]] */⏎ mw.libs.paneMarker.facilitate = function () { // Set document title to relevant page name and site name // Postcondition: // document.title has been set // Uses: // < document.title // Remark: wgRelevantPageName available since MW 1.20 // 2012-06-19 [email protected] var s = mw.config.get( "wgRelevantPageName" ); if ( ! s ) { s = mw.config.get( "wgPageName" ); } document.title = s.replace( /_/g, " " ) + " * " + mw.config.get( "wgSiteName" ); }; // .facilitate() mw.libs.paneMarker.favicon = function ( apply ) { // Try to exchange wiki-favicon // Precondition: // apply -- true: red icon (page used in vulnerable mode) // false: show user defined default project icon // Uses: // > this // > .site // > .config.favicon // > .config.appleIcon // > .config.faviconICO // > .config.faviconPNG // .file() // 2012-06-219 [email protected] var $apple, $head = $( document ).find( "head" ), $favicon, apple = false, i, light = apply, n = 0, (contracted; show full) } } } else { s = this.config.favicon; if ( s ) { if ( typeof s === "string" ) { offer = [ [ s, null ] ]; s witch ( s.slice( -4 ).toLowerCase() = s.slice( -4 ).toLowerCase(); switch ( s ) { case ".ico" : offer[0][1] = "image/x-icon"; break; case ".gif" :⏎ case ".png" : offer[0][1] = "image/png"" + s.substr(1); break; } // switch s.slice( -4 ).toLowerCase() } } } if ( offer ) { for ( i = 0; i < n; i++ ) { (contracted; show full) // > .config.lowChar // > .lazy // > .config.rightleft // >< document.title // < .leave // .facilitate() // Requires: JavaScript 1.3 String.fromCharCode() // 2012-0 6-198-20 [email protected] var c = true, learn = true; if ( this.config.leave ) { this.facilitate(); } else if ( this.heads.indexOf( this.site ) < 0 ) { c = this.config[ "char" + action ]; learn = false; (contracted; show full) } // switch action } if ( c ) { if ( ! this.config.leave ) { if ( action === "Links" ) { this.facilitate(); } } if ( typeof c === "number" ) { if ( c > 0 ) { c = String.fromCharCode( c ); } } if ( typeof c === "string" ) { if ( this.config.rightleft ) { document.title = document.title + " " + c; } else { c = c + " "; if ( document.title.indexOf( c ) !== 0 ) { document.title = c + document.title; } } } } } }; // .flag() mw.libs.paneMarker.flip = function () { // Abbreviate document title by namespace shortcut, if any // Uses: // > this // > .nsN // >< document.title // mw.config.get() // 2012-06-138-20 [email protected] var e, i, o, s, t; if ( this.nsN > 0 ) { o = mw.config.get( "wgNamespaceIds" ); for ( e in o ) { if ( o.hasOwnProperty( e ) ) { if ( e.length < 4 ) { // file help talk user if ( o[ e ] === this.nsN ) { o = mw.config.get( "wgFormattedNamespaces" ); s = o[ this.nsN ]; o = mw.config.get( "wgPageName" ); o = o.replace( /_/ig, " " ); if ( ! o.indexOf( s + ":" ) === 0 ) { t = document.title; i = t.indexOf( o ); if ( i >= 0 ) { document.title = ( i ? t.substr( 0, i ) : "" ) + e.toUpperCase() + t.substr( i + s.length ); } } break; // for e } // first match } } } // for e } }; // .flip() mw.libs.paneMarker.fresh = function () { // Run paneMarker in this particular situation // Precondition: // Page may be under loading, but not necessarily ready. // .using( [ "user", "mediawiki.util" ] ) // Uses: // > .opt.* // > .jQuery.browser // > .config.favicon // >< this.* // < .lazy⏎ // < .config.* // < .site // < .nsN // < .lazy⏎ // .flag() // mw.config.get() // mw.util.getParamValue() // .flip() // .favicon() // 2012-06-19 [email protected] var lenient = true; if ( typeof this.opt === "object" && this.opt ) { this.config = this.opt; } else { this.config = { }; } this.site = mw.config.get( "wgDBname" ); this.nsN = mw.config.get( "wgNamespaceNumber" ); if ( jQuery.browser ) { if ( jQuery.browser.msie ) { if ( jQuery.browser.version < 10 ) { this.lazy = true;8-20 [email protected] var lenient = true; this.lazy = false; if ( typeof this.opt === "object" && this.opt ) { this.config = this.opt; if ( typeof this.config.favicon === "boolean" ) { this.lazy = ! this.opt.favicon; } } else { this.config = { }; } this.site = mw.config.get( "wgDBname" ); this.nsN = mw.config.get( "wgNamespaceNumber" ); if ( ! this.lazy ) { if ( jQuery.browser ) { if ( jQuery.browser.msie ) { if ( jQuery.browser.version < 10 ) { this.lazy = true; } } } } switch ( mw.config.get( "wgAction" ) ) { case "edit" : case "submit" : if ( ! this.lazy ) { (contracted; show full)// Emacs // Local Variables: // encoding: utf-8-dos // coding: utf-8-dos // fill-column: 80 // End: /// EOF </nowiki> paneMarker/?.js All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://test.wikipedia.org/w/index.php?diff=prev&oldid=140991.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|