WebBrowser/Tools/Scripts.py

changeset 6142
304a469455c8
parent 6140
c20e2d414d0d
child 6149
e611e45a17d6
diff -r f4cecd941096 -r 304a469455c8 WebBrowser/Tools/Scripts.py
--- a/WebBrowser/Tools/Scripts.py	Mon Feb 12 19:19:50 2018 +0100
+++ b/WebBrowser/Tools/Scripts.py	Mon Feb 12 19:50:24 2018 +0100
@@ -86,6 +86,27 @@
         match, readAllFileContents(":/javascript/qwebchannel.js"))
 
 
+def setupWindowObject():
+    """
+    Function generating a script to setup window.object add-ons.
+    
+    @return generated script
+    @rtype str
+    """
+    source = """
+(function() {
+var external = {};
+
+window.external = external;
+
+window.print = function() {
+    window.location = 'eric:PrintPage';
+};
+})()"""
+    
+    return source
+
+
 def setStyleSheet(css):
     """
     Function generating a script to set a user style sheet.

eric ide

mercurial