User:Ketiga123/common.js

importScript('User:Visviva/pretext.js'); // importScript('User:ZBroz/Tbot.js'); // addOnloadHook(function { Tbot.greenifyTranslinks('cs'); Tbot.greenifyTranslinks('sk'); });

importScript("User:Erutuon/scripts/listSwitcher.js")

function insertTags(preTags, periTags, postTags) { $( '#wpTextbox1' ).textSelection( 'encapsulateSelection', {     pre: preTags,      peri: periTags,      post: postTags    }  ); }

function expandShortcuts { content=document.editform.wpTextbox1.value; frBase = '===Further reading===\n* ' furtherReadingCs = frBase + '\n* '; furtherReadingSk = frBase + ''; furtherReadingBn = frBase + '\n* '; furtherReadingCa = frBase + ''; furtherReadingDa = frBase + ''; furtherReadingDe = frBase + ''; furtherReadingEl = frBase + ''; furtherReadingEs = frBase + ''; furtherReadingEt = frBase + ''; furtherReadingEu = frBase + ''; furtherReadingFi = frBase + ''; furtherReadingFr = frBase + ''; furtherReadingHu = frBase + '\n* '; furtherReadingGa = frBase + ''; furtherReadingIs = frBase + ''; furtherReadingIt = frBase + ''; furtherReadingLv = frBase + ''; furtherReadingLt = frBase + ''; furtherReadingMg = frBase + ''; furtherReadingNl = frBase + ''; furtherReadingPl = frBase + ''; furtherReadingBg = frBase + ''; furtherReadingBe = frBase + ''; furtherReadingPt = frBase + ''; furtherReadingRo = frBase + ''; furtherReadingRu = frBase + ''; furtherReadingSh = frBase + ''; furtherReadingSl = frBase + ''; furtherReadingSq = frBase + ''; furtherReadingSv = frBase + ''; furtherReadingTa = frBase + ''; furtherReadingTe = frBase + ''; furtherReadingTr = frBase + ''; furtherReadingUk = frBase + ''; content=content .replace(/_-->_/g, '→') .replace(/_af_/g, '===Alternative forms===') .replace(/_e_/g, '===Etymology===') .replace(/_p_/g, '===Pronunciation===') .replace(/_pcs_/g, '===Pronunciation===\n* \n* ') .replace(/_s_/g, '====Synonyms====') .replace(/_sa_/g, 'See also') .replace(/_inf_/g, '') .replace(/_dt_/g, '====Derived terms====') .replace(/_rt_/g, '===Related terms===') .replace(/_fr_/g, '===Further reading===') .replace(/_frcs_/g, furtherReadingCs) .replace(/_frsk_/g, furtherReadingSk ) .replace(/_fren_/g, '===Further reading===\n* ')

.replace(/_ncs_/g, '==Czech==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingCs) .replace(/_ncspn_/g, '==Czech==\n\n===Proper noun===\n\n\n# _\n\n' + furtherReadingCs) .replace(/_ncsa_/g, '==Czech==\n\n===Adjective===\n\n\n# _\n\n' + furtherReadingCs) .replace(/_ncsv_/g, '==Czech==\n\n===Verb===\n\n\n# _\n\n' + furtherReadingCs) .replace(/_ncsadv_/g, '==Czech==\n\n===Adverb===\n\n\n# _\n\n' + furtherReadingCs) .replace(/_ncss_/g, '==Czech==\n\n===Suffix===\n\n\n# _\n\n' + furtherReadingCs) .replace(/_ncsp_/g, '==Czech==\n\n===Prefix===\n\n\n# _\n\n' + furtherReadingCs)

.replace(/_nsk_/g, '==Slovak==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingSk) .replace(/_nskpn_/g, '==Slovak==\n\n===Proper noun===\n\n\n# _\n\n' + furtherReadingSk) .replace(/_nska_/g, '==Slovak==\n\n===Adjective===\n\n\n# _\n\n' + furtherReadingSk) .replace(/_nskv_/g, '==Slovak==\n\n===Verb===\n\n\n# _\n\n' + furtherReadingSk)

.replace(/_nbe_/g, '==Belarusian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingBe) .replace(/_nbg_/g, '==Bulgarian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingBg) .replace(/_nbn_/g, '==Bengali==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingBn) .replace(/_nca_/g, '==Catalan==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingCa) .replace(/_nda_/g, '==Danish==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingDa) .replace(/_nde_/g, '==German==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingDe) .replace(/_nel_/g, '==Greek==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingEl) .replace(/_nes_/g, '==Spanish==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingEs) .replace(/_net_/g, '==Estonian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingEt) .replace(/_neu_/g, '==Basque==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingEu) .replace(/_nfi_/g, '==Finnish==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingFi) .replace(/_nfr_/g, '==French==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingFr) .replace(/_nga_/g, '==Irish==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingGa) .replace(/_nhu_/g, '==Hungarian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingHu) .replace(/_nis_/g, '==Icelandic==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingIs) .replace(/_nit_/g, '==Italian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingIt) .replace(/_nlv_/g, '==Latvian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingLv) .replace(/_nlt_/g, '==Lithuanian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingLt) .replace(/_nmg_/g, '==Malagasy==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingMg) .replace(/_nnl_/g, '==Dutch==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingNl) .replace(/_npl_/g, '==Polish==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingPl) .replace(/_npt_/g, '==Portuguese==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingPt) .replace(/_nuk_/g, '==Ukrainian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingUk) .replace(/_nro_/g, '==Romanian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingRo) .replace(/_nru_/g, '==Russian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingRu) .replace(/_nsh_/g, '==Serbo-Croatian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingSh) .replace(/_nsl_/g, '==Slovene==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingSl) .replace(/_nsq_/g, '==Albanian==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingSq) .replace(/_nsv_/g, '==Swedish==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingSv) .replace(/_nta_/g, '==Tamil==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingTa) .replace(/_nte_/g, '==Telugu==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingTe) .replace(/_ntr_/g, '==Turkish==\n\n===Noun===\n\n\n# _\n\n' + furtherReadingTr)

.replace(/_tr_/g, '====Translations====\n\n\n') ; document.editform.wpTextbox1.value=content; }

function addKeyListener { document.addEventListener("keydown", function(evt) {   qCode = 81;    f8Code = 119;    // if (evt.ctrlKey && evt.keyCode === qCode) {    if (evt.keyCode === f8Code) {      expandShortcuts;      evt.preventDefault;    }  }); }

$( addKeyListener ); /* equivalent to addOnloadHook */