Thành viên:Nguyễn Thanh Quang/Adminwarnings/monobook.js

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 ExplorerSafari: 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.

//<pre><nowiki>

function welcometn(num)
{
  var varticle = '';
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
  {t.value += '\n';}
  if (num==1)
  {
  t.value += "{{thế:Welcome4}}. ~~~~";
  f.wpSummary.value = "/* Hoan nghênh */";
  }
  else if (num==2)
  {
  t.value += "{{thế:Hoan nghênh vô danh}}. ~~~~";
  f.wpSummary.value = "/* Hoan nghênh */";
  }
  else if (num==3)
  {
  t.value += "{{thế:Welcome5}}. ~~~~";
  f.wpSummary.value = "/* Hoan nghênh */";
  }
  else if (num==4)
  {
  t.value += "{{thế:Hoan nghênh phá hoại}}";
  f.wpSummary.value = "Lưu ý: mọi phá hoại sẽ dẫn đến tài khoản bị khóa";
  }
}

function testn(number)
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "'''Đây là một [[địa chỉ IP]] được nhiều người sử dụng. Thành viên sử dụng IP này nhưng không liên quan xin [[Đặc biệt:Userlogin|tạo tài khoản hay đăng nhập]] để đóng góp tiện lợi hơn và xin bỏ qua thông báo này.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "==" + "Sửa đổi ngày [[{{subst:CURRENTDAY}} {{subst:CURRENTMONTHNAME}}]] năm [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{thế:" + "test" + number + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " thử nghiệm" + number;
}

function povn()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "'Đây là một [[địa chỉ IP]] được nhiều người sử dụng. Thành viên sử dụng IP này nhưng không liên quan xin [[Đặc biệt:Userlogin|tạo tài khoản hay đăng nhập]] để đóng góp tiện lợi hơn và xin bỏ qua thông báo này.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "==" + "Sửa đổi ngày [[{{subst:CURRENTDAY}} {{subst:CURRENTMONTHNAME}}]] năm [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + "NPOV0a" + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " NPOV0a";
}

function warningn()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "<br />':Đây là một [[địa chỉ IP]] được nhiều người sử dụng. Thành viên sử dụng IP này nhưng không liên quan xin [[Đặc biệt:Userlogin|tạo tài khoản hay đăng nhập]] để đóng góp tiện lợi hơn và xin bỏ qua thông báo này.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Sửa đổi ngày [[{{subst:CURRENTDAY}} {{subst:CURRENTMONTHNAME}}]] năm [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + IPnote + "{{subst:" + "hoan nghênh phá hoại" + "}} " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " không sửa lung tung";
}

function revertsn()
{
  var IPnoteR = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnoteR = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning, but aviod making any [[Wikipedia:revert|reverts]] within 24 hours of this warning in order to avoid any confusion.'' ";}
  var article = prompt("Enter the page name where the 3RR violation occured:")
  articleh = article.replace(/ /g, '_');
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Regarding reversions" + "[http://vi.wikipedia.org/w/index.php?title=" + articleh + "&action=history] " + "made on [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] to " + "[[" + article + "]]" + "==" + "\n" + "{{subst:" + "3rr" + "}} " + IPnoteR + "~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " 3rr";
}

function finalwn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += ":{{subst:" + "test4" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " cảnh báo lần cuố";
}

function blockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += ":{{subst:" + "test5" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " cấm tạm thời";
}

function indefblockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += ":{{subst:" + "vandalblock" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " cấm vĩnh viễn";
}

function usernameblockn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "UsernameBlocked" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " tên thành viên bị cấm";
}

function usernameblockvn()
{
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "UsernameBlocked-vandal" + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Lưu ý:" + " cấm tên thành viên";
}
function rrblockn()
{
  username_a = document.URL.match(/:.*:(.*)/);
  username=username_a[1];
  var article = prompt("Cho biết trên trang xảy ra vi phạm 3 lần hồi sửa:");
  articleh = article.replace(/ /g, '_');
  var well = prompt("Warning is already in context (*y* or *n*)?")
  var time = prompt("Enter the duration of the block (in hours)")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    {t.value += '\r';}
  t.value += '<div style="background-color: #f9f9f9; border: 1px solid red; padding: 3px;">' + '\n';
  if (well == 'y' || well == 'yes')
  {
  t.value += ":{{subst:" + "3rr3" + "}} The duration of the [http://vi.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username + " block] is " + time + " hours. [http://vi.wikipedia.org/w/index.php?title=" + articleh + "&action=history Here] are the reverts in question. ~" + "~" + "~" + "~" + "</div>";
  }
  else if (well == 'n' || well == 'no') 
  {
  t.value += "==" + "Regarding reversions" + "[http://vi.wikipedia.org/w/index.php?title=" + articleh + "&action=history] " + "made on [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] to " + "[[" + article + "]]" + "==" + "\n" + "{{subst:" + "3rr3" + "}} The duration of the [http://vi.wikipedia.org/w/index.php?title=Special%3ALog&type=block&user=&page=User:" + username + " block] is " + time + " hours. ~" + "~" + "~" + "~" + "</div>";
  }
  else 
  {
  prompt("Error, enter *y* or *n*.");
  return;
  }
  f.wpSummary.value = "Lưu ý:" + " cấm 3RR tạm thời";
}

function testbl()
{
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "'Đây là một [[địa chỉ IP]] được nhiều người sử dụng. Thành viên sử dụng IP này nhưng không liên quan xin [[Đặc biệt:Userlogin|tạo tài khoản hay đăng nhập]] để đóng góp tiện lợi hơn và xin bỏ qua thông báo này.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Sửa đổi ngày [[{{subst:CURRENTDAY}} {{subst:CURRENTMONTHNAME}}]] năm [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + "test2a}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice:" + " test2a";
}

function spam(type)
{
  if (type == 1){var temp = 'spam1'}
  else if (type == 2){var temp = 'spam2a'}
  var IPnote = '';
  if (document.title.split(' - ')[0].split('.').length == 4)
  {IPnote = "''Đây là một [[địa chỉ IP]] được nhiều người sử dụng. Thành viên sử dụng IP này nhưng không liên quan xin [[Đặc biệt:Userlogin|tạo tài khoản hay đăng nhập]] để đóng góp tiện lợi hơn và xin bỏ qua thông báo này.'' ";}
  var varticle = '';
  if (location.href.indexOf('&vanarticle=') != -1)
  {varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="==" + "Sửa đổi ngày [[{{subst:CURRENTDAY}} {{subst:CURRENTMONTHNAME}}]] năm [[{{subst:CURRENTYEAR}}]]" + varticle + "==" + "\n" + "{{subst:" + temp + "}} " + IPnote + "~" + "~" + "~" + "~";
  f.wpSummary.value = "User notice: " + temp;
}

function rrwarn()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*Thành viên đã bị cảnh cáo vì vi phạm [[Wikipedia:Qui định ba lần hồi sửa|quy định ba lần hồi sửa]]. Khi hết hãy cấm xin hãy lưu ý để tránh lặp lại vi phạm. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Kết quả: thành viên đã được cảnh báo)');
  f.wpSummary.value = "Trả lời: thành viên đã được cảnh báo";
}

function rrblock()
{
  var number = prompt("Thành viên bị cấm bao nhiêu giờ?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*Tôi đã cấm thành viên " + number + " giờ vì vi phạm [[WP:3RR]]. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Kết quả: ' + number + ' giờ)');
  f.wpSummary.value = "Trả lời: thành viên bị cấm";
}

function rrnoblock()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*Thành viên chưa vi phạm quy định [[Wikipedia:Qui định ba lần hồi sửa|3RR]] vì chưa có tới bốn lần hồi sửa trong vòng 24 giờ cũng như chưa có hành vi phá hoại. Tuy nhiên, tôi cũng đã cảnh báo thành viên vì sắp wi phạm [[Wikipedia:Qui định ba lần hồi sửa|3RR]]. " + "~" + "~" + "~" + "~";
  t.value = t.value.replace(/\(Result:\)/,'(Kết quả: chưa vi phạm)');
  f.wpSummary.value = "Trả lời: chưa vi phạm";
}

//more tabs
$(add_testn_tabs)
function add_testn_tabs()
{ 
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
  if (document.title.indexOf("Thảo luận:") == -1 && document.title.indexOf("thảo luận:") == -1 && document.title.indexOf("Thành viên:") == -1 && document.title.indexOf("MediaWiki:") == -1 && document.title.indexOf("Hình:") == -1 && document.title.indexOf("Wikipedia:") == -1 && document.title.indexOf("Tiêu bản:") == -1 && document.title.indexOf("Portal:") == -1 && document.title.indexOf("Help:") == -1 && document.title.indexOf("Trang Chính") == -1 && document.title.indexOf("Thể loại:") == -1)
      {
      if(document.getElementById('ca-edit'))
      {document.getElementById('ca-edit').firstChild.innerHTML = 'Sửa';}
      }
  else 
      {
      if(document.getElementById('ca-edit'))
      {document.getElementById('ca-edit').firstChild.innerHTML = 'Sửa';}
      if(document.getElementById('ca-talk'))
      {document.getElementById('ca-talk').firstChild.innerHTML = 'Thảo luận';}
      }
if (document.title.indexOf("Sửa đổi ") != -1)
{
  if (document.title.indexOf("Sửa đổi Thảo luận Thành viên:") != -1)
    {
        var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
        addlimenu(tabs, '{{tin nhắn}}', 'warnfunc');
        var warnfunc = document.getElementById('warnfunc').getElementsByTagName('ul')[0];
        addlilink(warnfunc, 'javascript:welcometn(1)', 'welcome4', '');
        addlilink(warnfunc, 'javascript:welcometn(3)', 'welcome5', '');
        addlilink(warnfunc, 'javascript:welcometn(2)', 'hoan nghênh vô danh', '');
        addlilink(warnfunc, 'javascript:welcometn(4)', 'hoan nghênh phá hoại', '');
        addlilink(warnfunc, 'javascript:testn(1)', 'test', '');
        addlilink(warnfunc, 'javascript:povn()', 'NPOV', '');
        addlilink(warnfunc, 'javascript:testn(2)', 'vandal', '');
        addlilink(warnfunc, 'javascript:testn(3)', 'vandal2', '');
        addlilink(warnfunc, 'javascript:warningn()', 'sửa lung tung', '');
        addlilink(warnfunc, 'javascript:testbl()', 'blanking', '');
        addlilink(warnfunc, 'javascript:spam(1)', 'spam', '');
        addlilink(warnfunc, 'javascript:spam(2)', 'spam2', '');
        addlilink(warnfunc, 'javascript:finalwn()', 'final', '');
        addlilink(warnfunc, 'javascript:blockn()', 'vblock', '');
        addlilink(warnfunc, 'javascript:indefblockn()', 'indefblock', ''); 
        addlilink(warnfunc, 'javascript:usernameblockn()', 'nameblock', '');
        addlilink(warnfunc, 'javascript:usernameblockvn()', 'vnameblock', '');
        addlilink(warnfunc, 'javascript:revertsn()', '3rr', '');
        addlilink(warnfunc, 'javascript:rrblockn()', 'rr block', '');
      if(document.getElementById('ca-delete'))
      {
        document.getElementById('ca-delete').firstChild.innerHTML = '<span style="color:red;">[x]</span>';
      }  
      if(document.getElementById('ca-move'))
      {
      document.getElementById('ca-move').firstChild.innerHTML = '[dc]';
      }  
      if(document.getElementById('ca-watch'))
      {
      document.getElementById('ca-watch').firstChild.innerHTML = '[td]';
       }  
      if(document.getElementById('ca-unwatch'))
      {
      document.getElementById('ca-unwatch').firstChild.innerHTML = '[ntd]';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Sửa đổi';
      }
    }
  else if (document.title.indexOf("Editing User:") != -1)
    {  
    var nothing = 'yes';
    }
  else if (document.title.indexOf("Editing Wikipedia:Requests for page protection (section)") != -1)
    {
      if(document.getElementById('ca-delete'))
      {
        document.getElementById('ca-delete').firstChild.innerHTML = '<span style="color:red;">[x]</span>';
      }  
      if(document.getElementById('ca-move'))
      {
      document.getElementById('ca-move').firstChild.innerHTML = '[dc]';
      } 
      if(document.getElementById('ca-watch'))
      {
      document.getElementById('ca-watch').firstChild.innerHTML = '[td]';
       }  
      if(document.getElementById('ca-unwatch'))
      {
      document.getElementById('ca-unwatch').firstChild.innerHTML = '[ntd]';
      }
    }
  else if (document.title.indexOf("Editing Wikipedia:Administrators' noticeboard/3RR (section)") != -1)
    {
    addTab('javascript:rrwarn()',"a|wn","ca-wn","Đã cảnh cáo","");
    addTab('javascript:rrblock()',"a|bl","ca-bl","Đã cấm","");
    addTab('javascript:rrnoblock()',"r|cl","ca-cl","Sắp vi phạm 3RR","");
    }
 else if(document.title.indexOf("Wikipedia:") != -1 || document.title.indexOf("Help:Contents/Editing Wikipedia") != -1 || document.title.indexOf("Editing Talk") != -1 || document.title.indexOf("Editing Wikipedia talk") != -1)
    {
  {nothing=1;}
    }
}
 else if (document.title.indexOf("Thành viên:") != -1)
 {
 if(document.getElementById('ca-talk'))
      {
     document.getElementById('ca-talk').firstChild.innerHTML = 'Thảo luận';
      }
 }
 else if (document.title.indexOf("Thảo luận Thành viên:") != -1)
 {
 if(document.getElementById('ca-talk'))
      {
     document.getElementById('ca-talk').firstChild.innerHTML = 'Thảo luận';
      }
  }
}
//</nowiki></pre>