summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2014-03-10 02:29:58 +0100
committerportix <portix@gmx.net>2014-03-10 02:29:58 +0100
commit6bcf8f283ac5a15117116c7fc3f7b28a8425837b (patch)
tree505e1bc561054fa53d9e0562a038ed20236d151c
parentea3deec2f814d130e41a193b11d5cf271db8f829 (diff)
downloaddwb-6bcf8f283ac5a15117116c7fc3f7b28a8425837b.zip
Remove unnessesary global variable from completion
-rw-r--r--scripts/modules/completion41
1 files changed, 24 insertions, 17 deletions
diff --git a/scripts/modules/completion b/scripts/modules/completion
index 45efd026..9f820f7d 100644
--- a/scripts/modules/completion
+++ b/scripts/modules/completion
@@ -1,21 +1,7 @@
var util = namespace("util");
var gui = namespace("gui");
-var mWidget = new HiddenWebView();
-
-mWidget.canFocus = false;
-mWidget.transparent = true;
-
-gui.mainBox.packStart(mWidget, false, false, 0);
-var wp = settings.widgetPacking;
-var idxStatus = wp.search(/[sS]/);
-var idxMain = wp.indexOf("w");
-if (idxStatus > idxMain) {
- gui.mainBox.reorderChild(mWidget, idxStatus);
-}
-else {
- gui.mainBox.reorderChild(mWidget, idxStatus + 1);
-}
+var mWidget;
function htmlContent() {
/*HEREDOC
@@ -144,8 +130,27 @@ function injectable() {
}
}
-mWidget.loadString(util.hereDoc(htmlContent));
-mWidget.inject(injectable, null, 64, true);
+function startupWidget() {
+ var widget, wp, is, iw;
+ widget = new HiddenWebView();
+
+ widget.canFocus = false;
+ widget.transparent = true;
+
+ gui.mainBox.packStart(widget, false, false, 0);
+ wp = settings.widgetPacking;
+ is = wp.search(/[sS]/);
+ iw = wp.indexOf("w");
+ if (is > iw) {
+ gui.mainBox.reorderChild(widget, is);
+ }
+ else {
+ gui.mainBox.reorderChild(widget, is + 1);
+ }
+ widget.loadString(util.hereDoc(htmlContent));
+ widget.inject(injectable, null, 64, true);
+ return widget;
+}
function Completion(args) {
if (!args.shortcut) {
@@ -341,5 +346,7 @@ Object.defineProperties(Completion.prototype, {
onHide : { value : function(){}, writable : true }
});
+mWidget = startupWidget();
+
return Completion;
/* vim: set ft=javascript: */