Commit debeb25f authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use more jquery features by Lingnan.

parent 7dec88e8
...@@ -126,22 +126,18 @@ function buildTables(element_list, rowPredicate, columnPredicate,\n ...@@ -126,22 +126,18 @@ function buildTables(element_list, rowPredicate, columnPredicate,\n
if ((row_list.length > 1) ||\n if ((row_list.length > 1) ||\n
(row_list.length == 1 && row_list[0].length > 1)) {\n (row_list.length == 1 && row_list[0].length > 1)) {\n
var first_element = row_list[0][0];\n var first_element = row_list[0][0];\n
var container = first_element.parentNode;\n var fake_table = $("<table>");\n
var fake_table = document.createElement("table");\n fake_table.addClass(tableClassName);\n
var i;\n fake_table.insertbefore(first_element);\n
var j;\n $.each(row_list, function() {\n
fake_table.className = tableClassName;\n var fake_row = $("<tr>");\n
container.insertBefore(fake_table, first_element);\n $.each(this, function() {\n
for (i = 0; i < row_list.length; i++) {\n var fake_cell = $("<td>");\n
var fake_row = document.createElement("tr");\n fake_cell.append(this);\n
var row_element_list = row_list[i];\n fake_row.append(fake_cell[0]);\n
for (j = 0; j < row_element_list.length; j++) {\n });\n
var fake_cell = document.createElement("td");\n fake_table.append(fake_row[0]);\n
fake_cell.appendChild(row_element_list[j]);\n });\n
fake_row.appendChild(fake_cell);\n
}\n
fake_table.appendChild(fake_row);\n
}\n
}\n }\n
}\n }\n
}\n }\n
...@@ -169,17 +165,17 @@ function fixLeftRightHeightAndFocus(fix_height) {\n ...@@ -169,17 +165,17 @@ function fixLeftRightHeightAndFocus(fix_height) {\n
var element = matched_left_element_list.snapshotItem(element_index);\n var element = matched_left_element_list.snapshotItem(element_index);\n
var right = document.evaluate(right_xpath, element, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\n var right = document.evaluate(right_xpath, element, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\n
var cell;\n var cell;\n
var row = document.createElement("tr");\n var row = $("<tr>");\n
var table = document.createElement("table");\n var table = $("<table>");\n
table.className = "fake";\n table.addClass("fake");\n
element.parentNode.insertBefore(table, element);\n table.insertBefore(element);\n
cell = document.createElement("td");\n cell = $("<td>");\n
cell.appendChild(element);\n cell.append(element);\n
row.appendChild(cell);\n row.append(cell[0]);\n
cell = document.createElement("td");\n cell = $("<td>");\n
cell.appendChild(right);\n cell.append(right);\n
row.appendChild(cell);\n row.append(cell[0]);\n
table.appendChild(row);\n table.append(row[0]);\n
}\n }\n
}\n }\n
autoFocus();\n autoFocus();\n
...@@ -237,13 +233,12 @@ var indexAllCheckBoxesAtBTInstallationOnLoad = function() {\n ...@@ -237,13 +233,12 @@ var indexAllCheckBoxesAtBTInstallationOnLoad = function() {\n
\n \n
var resizeIFrameOnLoad = function() {\n var resizeIFrameOnLoad = function() {\n
/* Resize all frames in document in order to remove sliders */\n /* Resize all frames in document in order to remove sliders */\n
var object_list = $("object.auto_height");\n $("object.auto_height").each(function(){\n
for( var i=0; i<object_list.length; i++) {\n var inner_frame = this.contentDocument;\n
var object_document = object_list[i];\n
var inner_frame = object_document.contentDocument;\n
if (inner_frame){\n if (inner_frame){\n
object_document.style.height = inner_frame.documentElement.offsetHeight + \'px\';}\n $(this).css("height", inner_frame.documentElement.offsetHeight + \'px\');\n
}\n }\n
});\n
}\n }\n
\n \n
var changed = false;\n var changed = false;\n
...@@ -264,68 +259,55 @@ var addOnChangeEventHandler = function() {\n ...@@ -264,68 +259,55 @@ var addOnChangeEventHandler = function() {\n
- clicking a relation field wheel\n - clicking a relation field wheel\n
- clicking on a input with type submit\n - clicking on a input with type submit\n
*/\n */\n
//var master = document.getElementById("master");\n $("#master div").each(function(i) {\n
var master = $("#master");\n if ($(this).attr("class") == "input") {\n
if (master) {\n $(this).children().each(function() {\n
//divs = master.getElementsByTagName("div");\n if ($(this).prop("tagName") == "INPUT" ||\n
divs = master.find("div");\n $(this).prop("tagName") == "SELECT" ||\n
for (i=0; i<divs.length; i++) {\n $(this).prop("tagName") == "TEXTAREA") {\n
if (divs[i].getAttribute("class") == "input") {\n if ($(this).val() == "update..." ||\n
nodes = divs[i].childNodes;\n ($(this).prop("tagName") == "INPUT" &&\n
\n $(this).attr("type") == \'submit\')) {\n
for (j=0; j<nodes.length; j++) {\n
if (nodes[j].nodeName == "INPUT" ||\n
nodes[j].nodeName == "SELECT" ||\n
nodes[j].nodeName == "TEXTAREA") {\n
if (nodes[j].value == "update..." ||\n
(nodes[j].nodeName == "INPUT" &&\n
nodes[j].type == \'submit\')) {\n
// this is a relation field wheel or a submit form button\n // this is a relation field wheel or a submit form button\n
nodes[j].onclick = function() { changed = false;};\n this.onclick = function() { changed = false;};\n
} else {\n } else {\n
if (!nodes[j].onchange) {\n if (!this.onchange) {\n
nodes[j].onchange = function() { changed = true; };\n this.onchange = function() { changed = true; };\n
}\n }\n
}\n }\n
} \n } \n
/* Listbox or MatrixBox */\n /* Listbox or MatrixBox */\n
if (nodes[j].nodeName == "DIV" && (\n if ($(this).prop("tagName") == "DIV" && (\n
nodes[j].getAttribute("class") == "listbox-container" ||\n $(this).attr("class") == "listbox-container" ||\n
nodes[j].getAttribute("class") == "MatrixContent")) {\n $(this).attr("class") == "MatrixContent")) {\n
trs = nodes[j].getElementsByTagName(\'td\');\n $(this).find(\'td\').each(function(){\n
for (k=0; k<trs.length; k++){\n if ($(this).attr("class") == "listbox-search-line") {\n
if (trs[k].getAttribute("class") == "listbox-search-line") {\n return non-false;\n
continue;\n
}\n
inputs = trs[k].getElementsByTagName(\'input\');\n
for (l=0; l<inputs.length; l++){\n
if (inputs[l].getAttribute("type") != "hidden" &&\n
!inputs[l].onchange) {\n
inputs[l].onchange = function() { changed = true; };\n
}\n
}\n
}\n
}\n
}\n }\n
$(this).find(\'input\').each(function(){\n
if ($(this).attr("type") != "hidden" &&\n
!this.onchange) {\n
this.onchange = function() { changed = true; };\n
}\n }\n
});\n
});\n
}\n }\n
});\n
}\n }\n
});\n
}\n }\n
\n \n
var rewriteIndentedSelect = function() {\n var rewriteIndentedSelect = function() {\n
/*\n /*\n
Under firefox, rewrite indented title categories using style definition.\n Under firefox, rewrite indented title categories using style definition.\n
This way we can select items by pressing the first letter of their name. */\n This way we can select items by pressing the first letter of their name. */\n
var master = $("#master");\n \n
if (master){\n $("#master select").each(function() {\n
selects = master.find("select");\n $(this).children().each(function() {\n
for (i=0; i<selects.length; i++) {\n if ($(this).prop("tagName") != "OPTION") {\n
options = selects[i].childNodes;\n
for (j=0; j<options.length; j++) {\n
if (options[j].nodeName != "OPTION") {\n
continue;\n continue;\n
}\n }\n
text = options[j].innerHTML;\n text = $(this).html();\n
if (text.substring(0, 1) == \'\\n\') {\n if (text.substring(0, 1) == \'\\n\') {\n
text = text.substring(1, text.length);\n text = text.substring(1, text.length);\n
}\n }\n
...@@ -341,12 +323,11 @@ var rewriteIndentedSelect = function() {\n ...@@ -341,12 +323,11 @@ var rewriteIndentedSelect = function() {\n
}\n }\n
if (level >= 1) {\n if (level >= 1) {\n
level = level / 4.;\n level = level / 4.;\n
options[j].innerHTML = text.replace(/^(&nbsp;)+/, "");\n $(this).html(text.replace(/^(&nbsp;)+/, ""));\n
options[j].style.paddingLeft = level+"em";\n $(this).css("paddingLeft", level+"em");\n
}\n
}\n
}\n
}\n }\n
});\n
});\n
}\n }\n
\n \n
function queryStringToArray(query_string){\n function queryStringToArray(query_string){\n
...@@ -355,7 +336,7 @@ function queryStringToArray(query_string){\n ...@@ -355,7 +336,7 @@ function queryStringToArray(query_string){\n
*/\n */\n
var final ={};\n var final ={};\n
var b = query_string.split(\'&\');\n var b = query_string.split(\'&\');\n
$.each(b, function(x,y){\n $.each(b, function(x, y){\n
var temp = y.split(\'=\');\n var temp = y.split(\'=\');\n
final[temp[0]] = temp[1];});\n final[temp[0]] = temp[1];});\n
return final \n return final \n
......
19 20
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment