Difference between revisions of "MediaWiki:Common.js"

From MakeICT Wiki
Jump to navigationJump to search
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
(function () {
 
(function () {
   var todos = $(".makeict-todo");
+
   var cloneNodesToList = function(list, nodes) {
  var todoContainer = $("#makeict-decision-summary")[0];
+
    for(var i=0; i<nodes.length; i++){
  for(var i=0; i<todos.length; i++){
+
      var listItem = document.createElement("li");
    var listItem = document.createElement("li");
+
      listItem.appendChild(nodes[i].cloneNode(true));
    listItem.appendChild(todos[i].cloneNode(true));
+
      list.appendChild(listItem);
    todoContainer.appendChild(listItem);
+
    }
 +
  };
  
   var decisions = $(".makeict-todo");
+
 
   var decisionContainer = $("#makeict-decision-summary");
+
   cloneNodesToList($("#makeict-todo-summary")[0], $(".makeict-todo"));
  for(var i=0; i<decisions.length; i++){
+
   cloneNodesToList($("#makeict-decision-summary")[0], $(".makeict-decision"));
    var listItem = document.createElement("li");
 
    listItem.appendChild(decisions[i].cloneNode(true));
 
    decisionContainer.appendChild(listItem);
 
  }
 
 
}());
 
}());

Revision as of 11:55, 8 March 2015

/* Any JavaScript here will be loaded for all users on every page load. */
(function () {
  var cloneNodesToList = function(list, nodes) {
    for(var i=0; i<nodes.length; i++){
      var listItem = document.createElement("li");
      listItem.appendChild(nodes[i].cloneNode(true));
      list.appendChild(listItem);
    }
  };


  cloneNodesToList($("#makeict-todo-summary")[0], $(".makeict-todo"));
  cloneNodesToList($("#makeict-decision-summary")[0], $(".makeict-decision"));
}());