Kullanıcı:Srhat/common.js: Revizyonlar arasındaki fark
İçerik silindi İçerik eklendi
kDeğişiklik özeti yok |
kDeğişiklik özeti yok |
||
153. satır: | 153. satır: | ||
editbox.value = editbox.value.replace(arrsearch[i],arrreplace[i]); |
editbox.value = editbox.value.replace(arrsearch[i],arrreplace[i]); |
||
} |
} |
||
} |
|||
/* CSS */ |
/* CSS */ |
||
document.write('<style type="text/css">' |
document.write('<style type="text/css">' |
14.16, 5 Eylül 2008 tarihindeki hâli
/*************
*** Regex menu framework 1.2
*** by [[m:user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Regex_menu_framework>
*************/
/* script'i yükle */
document.write('<script type="text/javascript" src="'
+ 'http://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js'
+ '&action=raw&ctype=text/javascript"></script>');
/* menü linkleri */
// Bu fonksiyonla menüye linkleri şöyle ekle: "regexTool('link text','function_name()')"
// The function name is the function defined in rfmscripts() below.
function rmflinks() {
regexTool('Custom regex','custom()'); // a default tool which performs regex input in a dynamic form
regexTool('Deneme','sikayetformu()');
}
/* scriptler */
// Below, define the functions linked to from rmflinks() above. These functions can use any JavaScript,
// but there is a set of simplified tools documented at
// http://meta.wikimedia.org/wiki/User:Pathoschild/Script:Regex_menu_framework .
/**Şikayet formu denemesi **/
function sikayetformu() {
/*Şikayet formu başlangıç genel kutu*/
var formsikayet = document.createElement('div');
formsikayet.setAttribute('id', 'f-sikayet'); //şikayet formunun id'si f-sikayet
editbox.parentNode.insertBefore(formsikayet,editbox.parentNode.firstChild);
//başlık
baslik = document.createElement('h3');
baslik.appendChild(document.createTextNode('Şikayet formu'));
formsikayet.appendChild(baslik);
//Şimdi açıklamanın bulunduğu bölümü yazalım
var aciklama = document.createElement('p');
aciklama.appendChild(document.createTextNode('Bu form size kolayca şikayetinizi eklemenize yardımcı olur. Aşağıdaki boşlukları doldurarak şikayetinizi ekleyebilirsiniz.'));
formsikayet.appendChild(aciklama);
/*Şimdi girişi kutularının altındaki linkler*/
//giriş forumunu tanıt
var girisformu = document.createElement('form');
girisformu.setAttribute('id', 'girisformu');
formsikayet.appendChild(girisformu);
// place marker for input boxes
inputlist = document.createElement('ol');
girisformu.appendChild(inputlist);
//linkler bölümü
var formlinkleri = document.createElement('ul');
girisformu.appendChild(formlinkleri);
//link formu kaydet
var yenimadde = document.createElement('li');
var yenilink = document.createElement('a');
yenilink.setAttribute('href', 'javascript:formTamam();');
yenilink.setAttribute('title', 'Formu kaydet');
yenilink.appendChild(document.createTextNode('Formu kaydet'));
yenimadde.appendChild(yenilink);
formlinkleri.appendChild(yenimadde);
/* Liste */
var formkutusu = document.createElement('li');
formlinkleri.appendChild(formkutusu);
/* Formları ekle*/
//form-isim
var yenigiris = createElement('textarea');
yenigiris.setAttribute('class', 'form-isim');
yenigiris.setAttribute('for','form-isim');
yenigiris.appendChild(document.createTextNode('Şikayet etmek istediğiniz kullanıcı:'));
formkutusu.appendchild(yenigiris);
formkutusu.appendChild(yenietiket);
customaddnew();
}
customaddne() {
/* count for later processing */
if("patterncount" in window) {
patterncount++;
}
else {
patterncount = 0;
}
/* add new list item */
var container = document.createElement('li');
inputlist.appendChild(container);
/* create search */
var newinput = document.createElement('textarea');
newinput.setAttribute('class','formsearch');
newinput.setAttribute('tabindex',patterncount+100);
newlabel = document.createElement('label');
newlabel.setAttribute('for','formsearch');
newlabel.appendChild(document.createTextNode('Search #'+(patterncount+1)));
container.appendChild(newlabel);
container.appendChild(newinput);
/* force newline */
container.appendChild(document.createElement('br'));
/* create replace */
var newinput = document.createElement('textarea');
newinput.setAttribute('class','formreplace');
newinput.setAttribute('tabindex',patterncount+101);
newlabel = document.createElement('label');
newlabel.setAttribute('for','formreplace');
newlabel.appendChild(document.createTextNode('Replace #'+(patterncount+1)));
container.appendChild(newlabel);
container.appendChild(newinput);
}
/* run patterns */
function customgo() {
/* get search and replace arrays */
var arrpatterns = regexform.getElementsByTagName('textarea');
arrsearch = new Array();
arrreplace = new Array();
var searchcount = -1;
var replacecount = -1;
for(i=0; i<arrpatterns.length; i++) {
/* search boxes */
if(arrpatterns[i].getAttribute('class') == 'formsearch') {
searchcount++;
arrsearch[searchcount] = arrpatterns[i].value;
}
/* replace boxes */
else if (arrpatterns[i].getAttribute('class') == 'formreplace') {
replacecount++;
arrreplace[replacecount] = arrpatterns[i].value;
}
}
/* perform patterns */
for(var i=0; i<arrsearch.length; i++) {
/* convert input to regex */
// without delimiters
if(!arrsearch[i].match(/^\s*\/[\s\S]*\/[a-z]*\s*$/i)) {
arrsearch[i] = new RegExp(arrsearch[i]);
}
// with delimiters
else {
// break into parts
var regpattern = arrsearch[i].replace(/^\s*\/([\s\S]*)\/[a-z]*\s*$/i,'$1');
var regmodifiers = arrsearch[i].replace(/^\s*\/[\s\S]*\/([a-z]*)\s*$/,'$1');
// filter invalid flags
regmodifiers = regmodifiers.replace(/[^gim]/ig,'');
// convert into array
arrsearch[i] = new RegExp(regpattern, regmodifiers);
}
/* perform */
editbox.value = editbox.value.replace(arrsearch[i],arrreplace[i]);
}
/* CSS */
document.write('<style type="text/css">'
+ '#f-sikayet { margin:1em; padding:0.5em; border:2px solid blue; }'
+ '#f-sikayet ol { list-style:none; border:1px solid #CCC; padding:0.5em; }'
+ '</style>');
// <pre>
/*
#########
### TemplateScript
### by [[user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/TemplateScript>
### * adds a menu of user-defined, form-specific templates
#########
*/
document.write('<script type="text/javascript" src="'
+ 'http://tr.wikisource.org/w/index.php?title=Kullanıcı:Srhat/TemplateScript.js'
+ '&action=raw&ctype=text/javascript"></script>');
/* define templates */
function define_templates() {
/* syntax: new_template('type','name','text','optional 1','optional 2','optional 3');
see documentation
*/
/* ### edit templates below ### */
new_template('edit','eser1','{{eser1\n | önceki =\n | sonraki =\n | başlık =\n | bölüm =\n | eser sahibi =\n | notlar =\n}}');
new_template('edit','kişi','{{Kişi\n |ismi =\n |soyismi başharfi=\n |yaşadığı tarih =\n |açıklamalar =\n |resim =\n |vikipedi_bağlantısı =\n |vikisöz_bağlantısı =\n |commons_bağlantısı =\n}}');
new_template('edit','başlık','{{başlık\n | başlık =\n | bölüm =\n | önceki =\n | sonraki =\n | kısa yol =\n | notlar =\n}}');
new_template('edit','hoşgeldin','{{subst:Hoşgeldin}}\n','VikiKaynak\'a hoş geldin!');
new_template('edit','düzenle','{{Düzenle}}\n','Düzenle');
new_template('edit','telif','{{telif}}\n','muhtemel telif ihlali!');
new_template('edit','çevirmensiz','{{çevirmensiz}}\n','çevirmeni belli değil!');
/* ### edit templates above ### */
}
/* Load script */
addOnloadHook(function() {templatescript(define_templates())});
// </pre>
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/41/Button_ho%C5%9Fgeldin.png",
"speedTip": "Hoşgeldin şablonu",
"tagOpen": "{{",
"tagClose": "}}",
"sampleText": "subst:Hoşgeldin"};
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/8/8f/Button_poeme.png",
"speedTip": "Şiir",
"tagOpen": '<poem>',
"tagClose": '</poem>',
"sampleText": "Şiiri ekle"};
};