76 document.getElementsByTagName('head')[0].appendChild(css); |
76 document.getElementsByTagName('head')[0].appendChild(css); |
77 }})()""" |
77 }})()""" |
78 |
78 |
79 style = css.replace("'", "\\'").replace("\n", "\\n") |
79 style = css.replace("'", "\\'").replace("\n", "\\n") |
80 return source.format(style) |
80 return source.format(style) |
81 |
|
82 |
|
83 def toggleMediaPause(pos): |
|
84 """ |
|
85 Function generating a script to toggle the paused state of a media element. |
|
86 |
|
87 @param pos position of the media element |
|
88 @type QPoint |
|
89 @return script to toggle the element paused state |
|
90 @rtype str |
|
91 """ |
|
92 source = """ |
|
93 (function() {{ |
|
94 var e = document.elementFromPoint({0}, {1}); |
|
95 if (!e) |
|
96 return; |
|
97 if (e.paused) |
|
98 e.play(); |
|
99 else |
|
100 e.pause(); |
|
101 }})()""" |
|
102 return source.format(pos.x(), pos.y()) |
|
103 |
|
104 |
|
105 def toggleMediaMute(pos): |
|
106 """ |
|
107 Function generating a script to toggle the mute state of a media element. |
|
108 |
|
109 @param pos position of the media element |
|
110 @type QPoint |
|
111 @return script to toggle the element mute state |
|
112 @rtype str |
|
113 """ |
|
114 source = """ |
|
115 (function() {[ |
|
116 var e = document.elementFromPoint({0}, {1}); |
|
117 if (!e) |
|
118 return; |
|
119 e.muted = !e.muted; |
|
120 }})()""" |
|
121 return source.format(pos.x(), pos.y()) |
|
122 |
81 |
123 |
82 |
124 def getFormData(pos): |
83 def getFormData(pos): |
125 """ |
84 """ |
126 Function generating a script to extract data for a form element. |
85 Function generating a script to extract data for a form element. |