Thành viên:Nguyenthephuc/monobook.js
Giao diện
Chú ý: Sau khi lưu thay đổi trang, bạn phải xóa bộ nhớ đệm của trình duyệt để nhìn thấy các thay đổi. Google Chrome, Firefox, Internet Explorer và Safari: Giữ phím ⇧ Shift và nhấn nút Reload/Tải lại trên thanh công cụ của trình duyệt. Để biết chi tiết và hướng dẫn cho các trình duyệt khác, xem Trợ giúp:Xóa bộ nhớ đệm.
/* add site wiki map */
function addWikiMap(){
var personal = document.getElementById("p-personal");
var wiki_map = new Array("http://vi.wikipedia.org","http://vi.wiktionary.org","http://vi.wikibooks.org","http://thuvienkhoahoc.com/tusach");
var wiki_name = new Array("Wikipedia","Wiktionary","Wikibooks","VLOS");
var html ='<div id="sitemap" class="pBody">';
html +='<ul>';
for (i=0;i<wiki_map.length;i++){
html +='<li id="'+wiki_name[i]+'" class="';
if (wiki_map[i]==wgServer) html +='active">'+wiki_name[i];
else html +='selected"><a href="'+wiki_map[i]+'" title="'+wiki_name[i]+'">'+wiki_name[i]+'</a>';
html +='</li>';
}
html +='</ul>';
html +='</div>';
personal.innerHTML = html + personal.innerHTML;
}
$(addWikiMap);
/*** Tra Từ Điển vdict.com ****/
function TUDIEN()
{
elCC = document.getElementById('p-tb');
if (elCC != null)
{
THTML = '<div class="portlet"><h5>từ điển vdict</h5><div class="pBody" align="center"><p>';
THTML += '<form name="vdict" method="get" action="http://vdict.com/gateway.php" target="_blank">';
THTML += '<input name="word" id="word" size="16" type="text" /><p />';
THTML += '<select name="dictionary">';
THTML += '<option value="0">Tất cả</option>';
THTML += '<option value="1" selected="selected">Từ điển Anh - Việt</option>';
THTML += '<option value="2">Việt - Anh</option>';
THTML += '<option value="3">Việt - Việt</option>';
THTML += '<option value="4">Việt - Pháp</option>';
THTML += '<option value="5">Pháp - Việt</option>';
THTML += '<option value="6">Computing</option>';
THTML += '<option value="7">Anh - Anh</option>';
THTML += '</select><p />';
THTML += '<input name="Submit" value="Tra cứu" type="submit" />';
THTML += '</form>';
THTML += '</div></div>';
elCC.innerHTML = THTML + elCC.innerHTML;
}
}
$(TUDIEN);
/**** Tùy chọn Bộ Gõ Tiếng Việt ****/
method=1;
on_off=1;
dockspell=1;
dauCu=1;
useCookie=1;
radio=0;
/* Add mulcat */
/*
Hàm này được viết tương tự hàm insertTags trong file
\skins\common\wikibits.js
Tác giả: Nguyễn Thế Phúc
Email: nguyenthephucmaster(at)gmail(dot)com
Trang nhà: http://thuvienkhoahoc.com
Cách sử dụng: Gõ tên mỗi thể loại trên một dòng.
Bôi đen các thể loại đó rồi click.
Chương trình sẽ chuyển chúng thành mã thể loại
Ví dụ: name cat1
name cat2
name cat3
Thành: [[Thể loại:name cat1]]
[[Thể loại:name cat2]]
[[Thể loại:name cat3]]
Giấy phép: GPL
*/
function insertMulTagCat(){
var txtarea = document.getElementById("wpTextbox1");
if (txtarea == null) return;
var selText;
if (document.selection && document.selection.createRange) { // IE/Opera
//save window scroll position
if (document.documentElement && document.documentElement.scrollTop)
var winScroll = document.documentElement.scrollTop
else if (document.body)
var winScroll = document.body.scrollTop;
//get current selection
txtarea.focus();
var range = document.selection.createRange();
selText = range.text;
if (selText == '') return;
//insert tags
var re1 = new RegExp("[\r\n]","g");
selText = selText.replace(re1,"]]\r\n[[Th\u1EC3 lo\u1EA1i:");
selText = "[[Th\u1EC3 lo\u1EA1i:" + selText + "]]";
var re2 = new RegExp("\r\n\\[\\[Th\u1EC3 lo\u1EA1i\:\\]\\]|\\[\\[Th\u1EC3 lo\u1EA1i\:\\]\\]\r\n","g");
selText = selText.replace(re2,"");
range.text = selText;
range.select();
//restore window scroll position
if (document.documentElement && document.documentElement.scrollTop)
document.documentElement.scrollTop = winScroll
else if (document.body)
document.body.scrollTop = winScroll;
} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla
//save textarea scroll position
var textScroll = txtarea.scrollTop;
//get current selection
txtarea.focus();
var startPos = txtarea.selectionStart;
var endPos = txtarea.selectionEnd;
selText = txtarea.value.substring(startPos, endPos);
if (selText == '') return;
//insert tags
var re1 = new RegExp("[\r\n]","g");
selText = selText.replace(re1,"]]\r\n[[Th\u1EC3 lo\u1EA1i:");
selText = "[[Th\u1EC3 lo\u1EA1i:" + selText + "]]";
var re2 = new RegExp("\r\n\\[\\[Th\u1EC3 lo\u1EA1i\:\\]\\]|\\[\\[Th\u1EC3 lo\u1EA1i\:\\]\\]\r\n","g");
selText = selText.replace(re2,"");
txtarea.value = txtarea.value.substring(0, startPos)
+ selText + txtarea.value.substring(endPos, txtarea.value.length);
//set new selection
txtarea.selectionStart = startPos + selText.length;
txtarea.selectionEnd = txtarea.selectionStart;
//restore textarea scroll position
txtarea.scrollTop = textScroll;
}
}
function vlosInsertEditButton(parent) {
var image = document.createElement("img");
image.width = 23;
image.height = 22;
image.className = "mw-toolbar-editbutton";
image.id = "image";
image.src = "http://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png";
image.border = 0;
image.alt = "alt-c";
image.title = "Gõ mỗi thể loại trên một dòng. Bôi đen tất cả rồi click";
image.style.cursor = "pointer";
image.onclick = function() {
insertMulTagCat();
return false;
};
parent.appendChild(image);
return true;
}
function addMulCat(){
var toolbar = document.getElementById("toolbar");
if (toolbar == null) return;
vlosInsertEditButton(toolbar);
}
$(addMulCat);