Bước tới nội dung

Thành viên:Trần Nguyễn Minh Huy/todo.js

Bách khoa toàn thư mở Wikipedia

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.

//HOW-TO:
//Add the following lines and to-do items to your JavaScript file (without the "//") where appropriate:
//importScript('User:Trần Nguyễn Minh Huy/todo.js');
//var todo_list = ["Item 1", "Item 2", "Item 3", "etc."]; //The last item shouldn't have a comma after the closing quotation mark.
 
 
function displayTodoList() {
    if(typeof(todo_list) == 'undefined') {
        alert("Xin vui lòng thêm một việc cần làm để Javascript thi hành ở định dạng này và tẩy bộ nhớ đệm:\n\nvar todo_list = [\"Item 1\", \"Item 2\", \"Item 3\"];");
    } else {
        var todo_list_text = "";
        for(i=0; i<todo_list.length; i++) {
            todo_list_text += (i+1) + ". " + todo_list[i] + "\n\n";
        }
        alert(todo_list_text);
    }
}
 
$(function() {
    mw.util.addPortletLink("p-cactions", "javascript:displayTodoList()", "todo", "ca-todo");
});