MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
m (ded dis)
(HTTPS all the things)
Line 5: Line 5:
  * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
  * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
  * Dual licensed under the MIT and GPL licenses:
  * Dual licensed under the MIT and GPL licenses:
  * http://www.opensource.org/licenses/mit-license.php
  * https://opensource.org/licenses/mit-license.php
  * http://www.gnu.org/licenses/gpl.html
  * https://www.gnu.org/licenses/gpl.html
  */
  */
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};
Line 13: Line 13:


/* JW Player */
/* JW Player */
if
if
/*  End JW Player*/
/*  End JW Player*/


Line 50: Line 50:
                 spoilers.thumbNodes = $(".gallerybox, .thumb");
                 spoilers.thumbNodes = $(".gallerybox, .thumb");
spoilers.text = $('<div style="display:inline;"></div>');
spoilers.text = $('<div style="display:inline;"></div>');
spoilers.imgOn = $('<img alt="" style="display:none;"/>').attr('src', 'http://i2.theportalwiki.net/img/2/2b/Wheatley_spoils_you.png');
spoilers.imgOn = $('<img alt="" style="display:none;"/>').attr('src', 'https://i2.theportalwiki.net/img/2/2b/Wheatley_spoils_you.png');
spoilers.imgOff = $('<img alt="" style="display:none;"/>').attr('src', 'http://i2.theportalwiki.net/img/e/ef/Wheatley_spoils_nothing.png');
spoilers.imgOff = $('<img alt="" style="display:none;"/>').attr('src', 'https://i2.theportalwiki.net/img/e/ef/Wheatley_spoils_nothing.png');
var wrapped = $('<li/>').append($('<span/>').append($('<a/>').append(spoilers.imgOn, spoilers.imgOff, spoilers.text)));
var wrapped = $('<li/>').append($('<span/>').append($('<a/>').append(spoilers.imgOn, spoilers.imgOff, spoilers.text)));
wrapped.click(spoilers.toggle);
wrapped.click(spoilers.toggle);
Line 470: Line 470:
if(diffText.length) {
if(diffText.length) {
// Preload leetle gif
// Preload leetle gif
$('body').append($('<img/>').attr('src', 'http://i2.theportalwiki.net/img/4/43/Patch_diff_loading.gif').css('display', 'none'));
$('body').append($('<img/>').attr('src', 'https://i2.theportalwiki.net/img/4/43/Patch_diff_loading.gif').css('display', 'none'));
diffText.find('span').each(function() {
diffText.find('span').each(function() {
$(this).text($(this).find('a').text().replace(/^\s+|\s+$/g));
$(this).text($(this).find('a').text().replace(/^\s+|\s+$/g));
Line 486: Line 486:
var lightboxStuff = {
var lightboxStuff = {
settings: {
settings: {
imageLoading: 'http://i2.theportalwiki.net/img/5/56/Lightbox_loading.gif',
imageLoading: 'https://i2.theportalwiki.net/img/5/56/Lightbox_loading.gif',
imageBtnClose: 'http://i2.theportalwiki.net/img/e/e2/Lightbox_button_close.gif',
imageBtnClose: 'https://i2.theportalwiki.net/img/e/e2/Lightbox_button_close.gif',
imageBtnPrev: 'http://i2.theportalwiki.net/img/c/c8/Lightbox_button_previous.gif',
imageBtnPrev: 'https://i2.theportalwiki.net/img/c/c8/Lightbox_button_previous.gif',
imageBtnNext: 'http://i2.theportalwiki.net/img/9/9e/Lightbox_button_next.gif',
imageBtnNext: 'https://i2.theportalwiki.net/img/9/9e/Lightbox_button_next.gif',
imageBlank: 'http://i2.theportalwiki.net/img/f/f6/Lightbox_blank.gif',
imageBlank: 'https://i2.theportalwiki.net/img/f/f6/Lightbox_blank.gif',
},
},
init: function() {
init: function() {
Line 770: Line 770:
var flattrButton = {
var flattrButton = {
init: function() {
init: function() {
$('#mw-panel').append($('<div class="flattr-sidebar"><a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://theportalwiki.com/wiki/Portal_Wiki:Donate"></a></div>'));
$('#mw-panel').append($('<div class="flattr-sidebar"><a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="https://theportalwiki.com/wiki/Portal_Wiki:Donate"></a></div>'));
$('head').append($('<script src="https://api.flattr.com/js/0.6/load.js?mode=auto" async="async"></script>'));
$('head').append($('<script src="https://api.flattr.com/js/0.6/load.js?mode=auto" async="async"></script>'));
}
}