mNo edit summary |
No edit summary |
||
Line 152: | Line 152: | ||
/*</pre>*/ |
/*</pre>*/ |
||
+ | |||
+ | /*jshint browser:true jquery:true curly:false smarttabs:true laxbreak:true laxcomma:true */ |
||
+ | /*global mediaWiki */ |
||
+ | |||
+ | if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'Upload' |
||
+ | && !(/(?:^\?|&)wpForReUpload=(?:[^0&]|0[^&])/).test(window.location.search) |
||
+ | ) |
||
+ | $(function($) { |
||
+ | "use strict"; |
||
+ | |||
+ | // Overlay the summary with a prompt for the image type. |
||
+ | var $textarea = $('#wpUploadDescription') |
||
+ | , $prompt = $(document.createElement('div')) |
||
+ | ; |
||
+ | // We need a position:relative parent to work with so we'll wrap the contents |
||
+ | $textarea.wrap('<div style="position:relative" />'); |
||
+ | var $container = $textarea.parent(); |
||
+ | |||
+ | // Textarea has width:100% so spills its borders |
||
+ | $textarea.css({ boxSizing: 'border-box', MozBoxSizing: 'border-box' }); |
||
+ | |||
+ | $prompt.css({ |
||
+ | position: 'absolute', |
||
+ | top: 0, |
||
+ | left: 0, |
||
+ | bottom: 0, |
||
+ | right: 0, |
||
+ | backgroundColor: 'rgba(0,0,0,0.8)' |
||
+ | }).append( |
||
+ | '<div style="text-align:center">' |
||
+ | + '<p><button class="upload-sd-panel" type="button">Anime Image</button></p>' |
||
+ | + '<p><button class="upload-other" type="button">Manga Image</button></p>' |
||
+ | + '</div>' |
||
+ | ); |
||
+ | $container.append($prompt); |
||
+ | |||
+ | // Disable the textarea in case we didn't cover it perfectly |
||
+ | $textarea.prop('disabled', true); |
||
+ | function unlockUI() { |
||
+ | $prompt.remove(); |
||
+ | $textarea.prop('disabled', false).css({ boxSizing: '', MozBoxSizing: '' }).unwrap(); |
||
+ | // NOTE: If we don't remove prompt then it will be promoted upwards as well |
||
+ | } |
||
+ | // Default text. "Other Image" button will leave this unmodified. |
||
+ | $textarea.val( |
||
+ | '{{preformatted manga-scan\n' |
||
+ | + '|from=scanalation/scanalation-blanked/raw/viz/clean\n' |
||
+ | + '|of=\n' |
||
+ | + '|thing=character/jutsu\n' |
||
+ | + '|chapter=\n' |
||
+ | + '|page=\n' |
||
+ | + '|url=\n' |
||
+ | + '|characters=\n' |
||
+ | + '|jutsu=\n' |
||
+ | + '}}' |
||
+ | ); |
||
+ | |||
+ | // Set up the event handlers |
||
+ | $prompt.find('.upload-sd-panel').click(function(evt) { |
||
+ | evt.preventDefault(); |
||
+ | $textarea.val( |
||
+ | '{{preformatted tv-screenshot\n' |
||
+ | + '|of=\n' |
||
+ | + '|thing=character/jutsu\n' |
||
+ | + '|part=\n' |
||
+ | + '|episode=\n' |
||
+ | + '|url=\n' |
||
+ | + '|characters=\n' |
||
+ | + '|jutsu=\n' |
||
+ | + '}}' |
||
+ | ); |
||
+ | unlockUI(); |
||
+ | }); |
||
+ | $prompt.find('.upload-other').click(function(evt) { |
||
+ | evt.preventDefault(); |
||
+ | unlockUI(); |
||
+ | }); |
||
+ | }); |
Revision as of 08:49, 17 November 2012
/*<pre>*/
/* Recent Changes Auto Refresh */
importScriptPage('AjaxRC/code.js','dev');
importScriptPage('DupImageList/code.js','dev');
importScriptPage('ListFiles/code.js','dev');
importScriptPage('User:UltimateSupreme/FixMultipleUpload.js','naruto');
importScriptPage('User:UltimateSupreme/SigReminder.js','naruto');
importScriptPage('PurgeButton/code.js','dev');
/* Include Global Anime-Common.js Information */
importScriptURI('http://anime.wikia.com/index.php?title=MediaWiki:Anime-Common.js&action=raw&ctype=text/javascript&dontcountme=s&smaxage=86400&templates=expand');
// ArchiveTool
var archiveListTemplate = 'ArchiveList';
var archivePageTemplate = 'ArchivePage';
importScriptPage('ArchiveTool/code.js', 'dev');
$(function() {
if ( skin === "monaco" ) {
var $siteNotice = $('#siteNotice');
$siteNotice.find('script').remove();
$siteNotice.insertBefore('#article');
$siteNotice.find('table table').appendTo($siteNotice);
$siteNotice.find('#mw-dismissable-notice').remove();
} else if ( skin === "oasis" || skin === "wikia" ) {
// START Notification Bubble Integration
/*jQuery(function($) {
function hasNotificationBubble() {
return !!$("#WikiaNotifications li").length;
}
function ensureWikiaNotificationsArea() {
if ( $('#WikiaNotifications').length )
return;
$('<ul id="WikiaNotifications" class="WikiaNotifications" />').prependTo('#WikiaFooter .toolbar');
}
function addNotificationBubble(msg, onclose) {
var $li = $('<li />');
var $div = $('<div data-type=2 />').html(msg).appendTo($li);
$('<a class="sprite close-notification" />')
.click(function() {
$(this).closest('li').remove();
if ( onclose )
onclose.apply(this, arguments);
})
.prependTo($div);
ensureWikiaNotificationsArea();
$li.appendTo("#WikiaNotifications");
}
function doReaderNotice(msg, id) {
if ( hasNotificationBubble() )
// Only display a reader bubble when nothing else is using the area
return;
var cookieName = "readernotice_bubble_dismiss";
if ( $.cookies.get(cookieName) === id.toString() )
return;
addNotificationBubble(msg, function() {
$.cookies.set(cookieName, id.toString(), { hoursToLive: 30*24 });
});
}
if ( $.cookies.get("readernotice_bubble_dismiss") === "1" ) {
doReaderNotice('Sorry if you already answered our survey, but we had issues with the last one. If you still have time please <a href="http://www.surveymonkey.com/s/narutopedia-look-survey">fill out our new survey</a>.', 2);
} else {
doReaderNotice('We\'d like to know what you think of Wikia\'s new look, if you have time please <a href="http://www.surveymonkey.com/s/narutopedia-look-survey">fill out this survey</a>.', 2);
}
});*/
// END Notification Bubble Integration
if ( wgNamespaceNumber > 0 && wgNamespaceNumber % 2 == 1 && /^.+\/Archive \d+$/.test( wgTitle ) ) {
// Archive pages are not meant to be edited so lower the priority of the edit button.
var $edit = $('#WikiaPageHeader .wikia-menu-button a:first');
$edit.find('img').remove();
$('<li>').append( $edit )
.appendTo( $('#WikiaPageHeader .wikia-menu-button .WikiaMenuElement') );
$('<a href="#">Archive Page</a>').prependTo( '#WikiaPageHeader .wikia-menu-button' );
if ( wgAction === "edit" ) {
var $n = $( '<li>This is an archive, it is <strong>NOT</strong> a talkpage. Please refrain from editing it without a good reason.</li>' );
$( '#EditPageEditor .editpage-notices ul').empty().append( $n );
}
}
} else {
$('#mw-dismissable-notice > tbody > tr > td:last').remove();
}
if( ( wgAction === "edit" && wgNamespaceNumber > -1 && wgNamespaceNumber % 2 === 0 ) || wgPageName === "Special:CreatePage" )
$("<div class=warningmessage>Do <strong>not</strong> add new manga information to the wiki until the entire chapter is available.</div>")
.prependTo(skin === "oasis" || skin === "wikia" ? '#WikiaArticle' : '#bodyContent');
if( wgAction === "edit" && wgNamespaceNumber === 8 && wgTitle === "Monaco-sidebar" ) {
$("#bodyContent #wikiPreview ul li").each(function() {
var n = this;
var texts = this.firstChild.nodeValue.replace(/^\s+/, "").replace(/\s+$/, "").split("|");
n.removeChild(n.firstChild);
var before = n.firstChild; texts.forEach(function(text, i) {
if ( i )
n.insertBefore(document.createTextNode("|"), before);
if ( /[#:]/.test(text) )
n.insertBefore(document.createTextNode(text), before);
else
n.insertBefore($("<a/>").attr({href: wgArticlePath.replace("$1", "MediaWiki:"+text.replace(/^\s+/, ""))}).text(text)[0], before);
});
});
}
});
// BEGINNING: JavaScript for placing the fair use rationale template inside the summary box on [[Special:Upload]]. Code by "[[wikipedia:User:Pinky49]]", created and coded specifically for [[wikia:c:cdnmilitary|Duty & Valour]].
function FairUseRationale() {
if((wgPageName == 'Special:Upload') && document.getElementById('wpDestFile').value == '') {
document.getElementById('wpUploadDescription').value = '{{Fair use rationale\n| Description = \n| Source = \n| Portion = \n| Purpose = \n| Resolution = \n| Replaceability = \n| Other Information = \n}}';
}
}
$(FairUseRationale);
// ****** END: JavaScript for [[Special:Upload]] ******
/* Custom Edit buttons - http://en.wikipedia.org/wiki/User:MarkS/Extra_edit_buttons */
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images4.wikia.nocookie.net/__cb20100821183407/bleach/en/images/d/db/U_Accent_Button.png",
"speedTip": "Add the ū character",
"tagOpen": "ū",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images2.wikia.nocookie.net/__cb20100821183407/bleach/en/images/e/e1/O_Accent_Button.png",
"speedTip": "Add the ō character",
"tagOpen": "ō",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images1.wikia.nocookie.net/naruto/images/7/79/Button_reflink.png",
"speedTip": "Add a Chapter Reference",
"tagOpen": "<ref>",
"tagClose": "</ref>",
"sampleText": "''Naruto'' chapter 0, page 0"};
}
/*</pre>*/
/*jshint browser:true jquery:true curly:false smarttabs:true laxbreak:true laxcomma:true */
/*global mediaWiki */
if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'Upload'
&& !(/(?:^\?|&)wpForReUpload=(?:[^0&]|0[^&])/).test(window.location.search)
)
$(function($) {
"use strict";
// Overlay the summary with a prompt for the image type.
var $textarea = $('#wpUploadDescription')
, $prompt = $(document.createElement('div'))
;
// We need a position:relative parent to work with so we'll wrap the contents
$textarea.wrap('<div style="position:relative" />');
var $container = $textarea.parent();
// Textarea has width:100% so spills its borders
$textarea.css({ boxSizing: 'border-box', MozBoxSizing: 'border-box' });
$prompt.css({
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
backgroundColor: 'rgba(0,0,0,0.8)'
}).append(
'<div style="text-align:center">'
+ '<p><button class="upload-sd-panel" type="button">Anime Image</button></p>'
+ '<p><button class="upload-other" type="button">Manga Image</button></p>'
+ '</div>'
);
$container.append($prompt);
// Disable the textarea in case we didn't cover it perfectly
$textarea.prop('disabled', true);
function unlockUI() {
$prompt.remove();
$textarea.prop('disabled', false).css({ boxSizing: '', MozBoxSizing: '' }).unwrap();
// NOTE: If we don't remove prompt then it will be promoted upwards as well
}
// Default text. "Other Image" button will leave this unmodified.
$textarea.val(
'{{preformatted manga-scan\n'
+ '|from=scanalation/scanalation-blanked/raw/viz/clean\n'
+ '|of=\n'
+ '|thing=character/jutsu\n'
+ '|chapter=\n'
+ '|page=\n'
+ '|url=\n'
+ '|characters=\n'
+ '|jutsu=\n'
+ '}}'
);
// Set up the event handlers
$prompt.find('.upload-sd-panel').click(function(evt) {
evt.preventDefault();
$textarea.val(
'{{preformatted tv-screenshot\n'
+ '|of=\n'
+ '|thing=character/jutsu\n'
+ '|part=\n'
+ '|episode=\n'
+ '|url=\n'
+ '|characters=\n'
+ '|jutsu=\n'
+ '}}'
);
unlockUI();
});
$prompt.find('.upload-other').click(function(evt) {
evt.preventDefault();
unlockUI();
});
});