Commit 234b78d5 authored by Xavier Hardy's avatar Xavier Hardy

RunMyDoc made compatible with Zelenium Tests

parent fdda79de
...@@ -49,7 +49,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n ...@@ -49,7 +49,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
*/\n */\n
var textContent, testPageHTML, body;\n var textContent, testPageHTML, body;\n
function cleanForPrince(){\n function cleanForPrince(){\n
var temp = $(\'iframe\', window.top.document).contents().children().clone();\n var temp = $(\'iframe\', parent.document).contents().children().clone();\n
$(\'script\', temp).remove();\n $(\'script\', temp).remove();\n
$(\'style, meta:not([name=author])\', temp).remove();\n $(\'style, meta:not([name=author])\', temp).remove();\n
var images = $(\'img\', temp);\n var images = $(\'img\', temp);\n
...@@ -96,7 +96,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n ...@@ -96,7 +96,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
}\n }\n
result += chr;\n result += chr;\n
}\n }\n
$(\'textarea[name=field_book_text_content]\', window.top.document).val(\'<html>\\n\' + result + \'\\n</html>\');\n $(\'textarea[name=field_book_text_content]\', parent.document).val(\'<html>\\n\' + result + \'\\n</html>\');\n
return false;\n return false;\n
}\n }\n
\n \n
......
...@@ -119,7 +119,7 @@ function findId(object){\n ...@@ -119,7 +119,7 @@ function findId(object){\n
}\n }\n
\n \n
function getAuthor(){\n function getAuthor(){\n
return $(\'#logged_in_as\', window.top.document).text().replace(\'Logged In as :\', \'\').trim();\n return $(\'#logged_in_as\', document).text().replace(\'Logged In as :\', \'\').trim();\n
}\n }\n
\n \n
function validateComment(object, clicked){\n function validateComment(object, clicked){\n
...@@ -129,7 +129,7 @@ function validateComment(object, clicked){\n ...@@ -129,7 +129,7 @@ function validateComment(object, clicked){\n
var color = $(\'#review_tooltip\').css(\'background-color\');\n var color = $(\'#review_tooltip\').css(\'background-color\');\n
//Saving\n //Saving\n
var id = findId(editedObject);\n var id = findId(editedObject);\n
var commentaryListObj = $("textarea[name=field_my_annotation]",window.top.document);\n var commentaryListObj = $("textarea[name=field_my_annotation]", document);\n
var commentaryList = commentaryListObj.val().split(\'\\n\');\n var commentaryList = commentaryListObj.val().split(\'\\n\');\n
var commentArray = parseCommentLine(commentaryList[id]);\n var commentArray = parseCommentLine(commentaryList[id]);\n
commentArray[0] = text;\n commentArray[0] = text;\n
...@@ -164,7 +164,7 @@ function editComment(object, e){\n ...@@ -164,7 +164,7 @@ function editComment(object, e){\n
}\n }\n
\n \n
function removeLine(name, id){\n function removeLine(name, id){\n
var obj = $("textarea[name=field_" + name + "]",window.top.document);\n var obj = $("textarea[name=field_" + name + "]", document);\n
var text = obj.val().split(\'\\n\');\n var text = obj.val().split(\'\\n\');\n
text.splice(id,1);\n text.splice(id,1);\n
obj.val(text.join(\'\\n\'));\n obj.val(text.join(\'\\n\'));\n
...@@ -198,7 +198,7 @@ function addComment(commentArray, notSetup, e){\n ...@@ -198,7 +198,7 @@ function addComment(commentArray, notSetup, e){\n
var object = $(locator, context);\n var object = $(locator, context);\n
\n \n
if(notSetup){\n if(notSetup){\n
var commentaryListObj = $("textarea[name=field_my_annotation]",window.top.document);\n var commentaryListObj = $("textarea[name=field_my_annotation]", document);\n
var commentaryList = commentaryListObj.val();\n var commentaryList = commentaryListObj.val();\n
if(commentaryList.trim() != \'\'){\n if(commentaryList.trim() != \'\'){\n
commentaryList += \'\\n\';\n commentaryList += \'\\n\';\n
...@@ -335,12 +335,11 @@ $(document).ready(function(){\n ...@@ -335,12 +335,11 @@ $(document).ready(function(){\n
return false;\n return false;\n
});\n });\n
var cssLink = document.createElement("link");\n var cssLink = document.createElement("link");\n
cssLink.href = window.top.document.URL.split(\'review_module\')[0] + "reviewer.css"; \n cssLink.href = document.URL.split(\'review_module\')[0] + "reviewer.css"; \n
cssLink.rel = "stylesheet"; \n cssLink.rel = "stylesheet"; \n
cssLink.type = "text/css"; \n cssLink.type = "text/css"; \n
this.contentDocument.body.appendChild(cssLink);\n this.contentDocument.body.appendChild(cssLink);\n
\n var commentaryListObj = $("textarea[name=field_my_annotation]", document);\n
var commentaryListObj = $("textarea[name=field_my_annotation]",window.top.document);\n
var commentaryList = commentaryListObj.val().split(\'\\n\');\n var commentaryList = commentaryListObj.val().split(\'\\n\');\n
var n = commentaryList.length;\n var n = commentaryList.length;\n
for(var i = 0; i < n; i++){\n for(var i = 0; i < n; i++){\n
......
...@@ -197,7 +197,7 @@ function appendSlideButtons(element, index){\n ...@@ -197,7 +197,7 @@ function appendSlideButtons(element, index){\n
$(document).ready(function(){\n $(document).ready(function(){\n
$(function() {\n $(function() {\n
//Extract the slides\n //Extract the slides\n
textContent = window.top.document.getElementsByName(\'field_my_text_content\')[0];\n textContent = document.getElementsByName(\'field_my_text_content\')[0];\n
var tmp = document.createElement(\'tmp\');\n var tmp = document.createElement(\'tmp\');\n
testPageHTML = document.createElement(\'html\');\n testPageHTML = document.createElement(\'html\');\n
testPageHTML.appendChild(document.createElement(\'head\'));\n testPageHTML.appendChild(document.createElement(\'head\'));\n
......
...@@ -143,7 +143,7 @@ function prependEditButtons(element){\n ...@@ -143,7 +143,7 @@ function prependEditButtons(element){\n
$(document).ready(function(){\n $(document).ready(function(){\n
$(function() {\n $(function() {\n
//Extract slide list\n //Extract slide list\n
textContent = window.top.document.getElementsByName(\'field_my_text_content\')[0];\n textContent = document.getElementsByName(\'field_my_text_content\')[0];\n
var tmp = document.createElement(\'tmp\');\n var tmp = document.createElement(\'tmp\');\n
testPageHTML = document.createElement(\'html\');\n testPageHTML = document.createElement(\'html\');\n
testPageHTML.appendChild(document.createElement(\'head\'));\n testPageHTML.appendChild(document.createElement(\'head\'));\n
......
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