$(document).ready(function () {
if ($('#editform').length) {
var templates = [];
var i = 0;
window.new_template = function (i_type, i_name, i_text, i_option1, i_topbottom) {
/* create array */
templates[i] = [];
templates[i][0] = i_type;
templates[i][1] = i_name;
templates[i][2] = i_text;
templates[i][3] = i_option1;
templates[i][4] = i_topbottom;
/* increment for next */
i++;
}
$('a.fcnlinks').live('click', function (event){
if (templates[this['id']][4] == 'top') {
$('#wpTextbox1').val(templates[this['id']][2] + '\n' + $('#wpTextbox1').val());
}
else if (templates[this['id']][4] == 'bottom') {
$('#wpTextbox1').val($('#wpTextbox1').val() + '\n' + templates[this['id']][2]);
}
$('#wpSummary').val(templates[this['id']][3]);
event.preventDefault();
});
$('#wikiPreview').append('<div id="fcnlinkboxcontainer">'
+ '<div class="fcnlinkbox">'
+ '<b>Genel Şablonlar</b><br />'
+ '<ul class="fcnlinks" id="links1"></ul></div>'
+ '<div class="fcnlinkbox">'
+ '<b><a href="http://tr.wikipedia.org/wiki/Kategori:Kullan%C4%B1c%C4%B1_uyar%C4%B1_%C5%9Fablonlar%C4%B1">Kullanıcı uyarı</a></b><br />'
+ '<ul class="fcnlinks" id="links2"></ul></div>'
+ '<div class="fcnlinkbox">'
+ '<b><a href="http://tr.wikipedia.org/wiki/VP:HS">HS</a> - Genel</b><br />'
+ '<ul class="fcnlinks" id="links3"></ul></div>'
+ '<div class="fcnlinkbox">'
+ '<b><a href="http://tr.wikipedia.org/wiki/VP:HS">HS</a> - Mad./Yön.</b><br />'
+ '<ul class="fcnlinks" id="links4"></ul></div>'
+ '<div class="fcnlinkbox" style="border-right:0;">'
+ '<b><a href="http://tr.wikipedia.org/wiki/VP:HS">HS</a> - Kat./RM/KS</b><br />'
+ '<ul class="fcnlinks" id="links5"></ul></div>'
+ '<br style="clear:both;" /></div>').show();
$.getScript('http://tr.wikipedia.org/w/index.php?title=Kullanıcı:Fcn/user.js&action=raw'
+ '&ctype=text/javascript&dontcountme=s', function () {
$.each(templates, function (i, n) {
if ( this[0] === "birinci" ) {
$('#links1').append('<li><a class="fcnlinks" id="' + i + '" href="#">' + this[1] + '</a></li>');
}
if ( this[0] === "ikinci" ) {
$('#links2').append('<li><a class="fcnlinks" id="' + i + '" href="#">' + this[1] + '</a></li>');
}
if ( this[0] === "ucuncu" ) {
$('#links3').append('<li><a class="fcnlinks" id="' + i + '" href="#">' + this[1] + '</a></li>');
}
if ( this[0] === "dorduncu" ) {
$('#links4').append('<li><a class="fcnlinks" id="' + i + '" href="#">' + this[1] + '</a></li>');
}
if ( this[0] === "besinci" ) {
$('#links5').append('<li><a class="fcnlinks" id="' + i + '" href="#">' + this[1] + '</a></li>');
}
});
});
}
});