사용자:Enigma7seven/FileMaintenance.js

위키백과, 우리 모두의 백과사전.

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다. 구글 크롬, 파이어폭스, 마이크로소프트 엣지, 사파리: ⇧ Shift 키를 누른 채 "새로 고침" 버튼을 클릭하십시오. 더 자세한 정보를 보려면 위키백과:캐시 무시하기 항목을 참고하십시오.

/** Filemaintenance ***********
*** Author: [[User:Kwj2772]], edited by [[User:Enigma7seven]] ****/

/* getParamValue, 이 스크립트에서 쓰이는 메소드 */
/* 직접 작동하지는 않지만 없어서는 안됨 */
/** extract a URL parameter from the current URL **********
 * From [[en:User:Lupin/autoedit.js]]
 *
 * paramName  : the name of the parameter to extract
 *
 * Local Maintainer: [[User:Dschwen]]
 */
 
function getParamValue( paramName, url) 
{
 if (typeof (url) == 'undefined' ) url = document.location.href;
 var cmdRe=RegExp( '[&?]' + paramName + '=([^&]*)' );
 var m=cmdRe.exec(url);
 if (m) {
  try {
   return decodeURIComponent(m[1]);
  } catch (someError) {}
 }
 return null;
}
var encodedpage = encodeURIComponent(mw.config.get('wgPageName'));

/* Explanation for TinEye (TinEye only!) */
// adapted from TinEye gadget for Commons
// To use, add this to your user skin preferences file (probably User:YourUsername/monobook.js):
//
// importScript('User:Twp/tineye.js');
function TinEye () {
 if ((wgNamespaceNumber != 6) || (wgAction != "view") || !document.getElementById('file')) return;
 var links = document.getElementById('file').getElementsByTagName('a');
 if (!links.length) return;
 var imageurl = links[links.length-1].href; //imageboxes adds links _before_, so we get the last link
 
 if (document.getElementById('file').getElementsByTagName('img')[0].width <= 300) {
   imageurl = document.getElementById('file').getElementsByTagName('img')[0].src; //Image smaller than 300px width
 } else { //Get thumb url
   var n = imageurl.indexOf("/ko/");
   imageurl = imageurl.substring(0, n + ("/ko/").length) + "thumb/" + imageurl.substring(n + ("/ko/").length);
 
   n = imageurl.lastIndexOf('/') + 1;
   imageurl = imageurl + "/300px-" + imageurl.substring(n); 
 }
 
if (wgNamespaceNumber == 6) {
 mw.util.addPortletLink('p-cactions', 'http://tineye.com/search?url=' + encodeURIComponent(imageurl), 'Tineye', 'ca-tineye');
 }
}
 
$(TinEye);
 
 
/* Image Maintenance Tools */
/* Author: [[User:Kwj2772]] */
/* License: CC-BY-SA-3.0, CC-BY-SA-2.0-KR */
function ImgMaintenance () {
      if (wgNamespaceNumber == 6) {
            mw.util.addPortletLink('p-cactions', 'http://ko.wikipedia.org/w/index.php?title=' + encodedpage + '&action=edit&imgmark=nld', 'nld', 'ca-nld', '라이선스 없음', null, null);
            mw.util.addPortletLink('p-cactions', 'http://ko.wikipedia.org/w/index.php?title=' + encodedpage + '&action=edit&imgmark=nsd', 'nsd', 'ca-nsd', '출처 없음', null, null);
            mw.util.addPortletLink('p-cactions', 'http://ko.wikipedia.org/w/index.php?title=' + encodedpage + '&action=edit&imgmark=unknowncopyright', '저작권?', 'ca-maybecopyvio', '저작권 침해 의심', null, null);
            mw.util.addPortletLink('p-cactions', 'http://ko.wikipedia.org/w/index.php?title=' + encodedpage + '&action=edit&imgmark=delete', '삭제 신청', 'copyright-delete', '저작권 침해 삭제', null, null);
            mw.util.addPortletLink('p-cactions', 'http://en.wikipedia.org/w/index.php?title=File:' + wgTitle, 'en', 'ca-enfilelink', '영어판의 파일', null, null);
            mw.util.addPortletLink('p-cactions', 'http://commons.wikimedia.org/wiki/File:' + wgTitle, 'commons', 'ca-enfilelink', '공용의 파일', null, null);
       }
       var ImgMarkParam = getParamValue("imgmark");
       if (wgNamespaceNumber == 6 && ImgMarkParam == "nld") {
             document.editform.wpTextbox1.value += '\{\{subst:nld\}\}'
             document.editform.wpSummary.value = '라이선스 없음'
             document.editform.wpMinoredit.checked = true;
             window.setTimeout (function autosave() { document.editform.wpSave.click(); }, 200); /* Save! */
       } else if (wgNamespaceNumber == 6 && ImgMarkParam == "nsd") {
             document.editform.wpTextbox1.value += '\{\{subst:nsd\}\}'
             document.editform.wpSummary.value = '그림의 출처 없음'
             document.editform.wpMinoredit.checked = true;
             window.setTimeout (function autosave() { document.editform.wpSave.click(); }, 200); /* Save! */
       } else if (wgNamespaceNumber == 6 && ImgMarkParam == "unknowncopyright") {
             document.editform.wpTextbox1.value += '\{\{저작권?\}\}'
             document.editform.wpSummary.value = '저작권 침해 의심'
             document.editform.wpMinoredit.checked = true;
             window.setTimeout (function autosave() { document.editform.wpSave.click(); }, 200); /* Save! */
       } else if (wgNamespaceNumber == 6 && ImgMarkParam == "delete") {
             document.editform.wpTextbox1.value += '\{\{ㅆ\|저작권\}\}'
             document.editform.wpSummary.value = '삭제 신청함'
             document.editform.wpMinoredit.checked = false;
             window.setTimeout (function autosave() { document.editform.wpSave.click(); }, 200); /* Save! */
       }
 
}
 
$(ImgMaintenance);