summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2014-03-10 02:22:20 +0100
committerportix <portix@gmx.net>2014-03-10 02:22:20 +0100
commitea3deec2f814d130e41a193b11d5cf271db8f829 (patch)
treeb9313d4adcf4bf1d0ac9181b4515a663a36c0e88
parent093f0f62adbe69e79dea500b8b25f18246328242 (diff)
downloaddwb-ea3deec2f814d130e41a193b11d5cf271db8f829.zip
Clean up completion module
-rw-r--r--scripts/modules/completion62
1 files changed, 37 insertions, 25 deletions
diff --git a/scripts/modules/completion b/scripts/modules/completion
index 32976d9d..45efd026 100644
--- a/scripts/modules/completion
+++ b/scripts/modules/completion
@@ -7,7 +7,15 @@ mWidget.canFocus = false;
mWidget.transparent = true;
gui.mainBox.packStart(mWidget, false, false, 0);
-gui.mainBox.reorderChild(mWidget, 2);
+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);
+}
function htmlContent() {
/*HEREDOC
@@ -53,8 +61,16 @@ body {
-webkit-user-select:none;
}
</style>
-<script type="text/javascript">
- var mSelectedIdx = -1, mElements;
+</head>
+<body>
+<div id="content"></div>
+</body>
+HEREDOC*/
+}
+
+function injectable() {
+ var mSelectedIdx = -1;
+ var mElements;
function clear() {
document.getElementById("content").innerHTML = "";
mElements = null;
@@ -126,15 +142,10 @@ body {
}
}
}
-</script>
-</head>
-<body>
-<div id="content"></div>
-</body>
-HEREDOC*/
}
mWidget.loadString(util.hereDoc(htmlContent));
+mWidget.inject(injectable, null, 64, true);
function Completion(args) {
if (!args.shortcut) {
@@ -153,18 +164,19 @@ function Completion(args) {
Object.defineProperties(Completion.prototype, {
// private
- _sigKeyPress : { value : null, writable : true },
- _sigKeyRelease : { value : null, writable : true },
- _idLabelNotify : { value : -1, writable : true },
- _lastText : { value : "", writable : true },
- _data : { value : {}, writable : true },
- _height : { value : 0, writable : true },
+ _sigKeyPress : { value : null, writable : true },
+ _sigKeyRelease : { value : null, writable : true },
+ _idLabelNotify : { value : -1, writable : true },
+ _lastText : { value : "", writable : true },
+ _data : { value : null, writable : true },
+ _height : { value : 0, writable : true },
_cleanup : {
value : function() {
this._sigKeyRelease.disconnect();
this._sigKeyPress.disconnect();
gui.messageLabel.disconnect(this._idLabelNotify);
+ this._idLabelNotify = -1;
gui.messageLabel.label = "";
mWidget.inject("clear()");
@@ -316,17 +328,17 @@ Object.defineProperties(Completion.prototype, {
}
},
// public
- widget : { value : mWidget },
+ widget : { value : mWidget },
// public overridable properties
- onUpdate : { value : null, writable : true },
- onSelected : { value : null, writable : true },
- shortcut : { value : null, writable : true },
- label : { value : ":", writable : true },
- visibleItems : { value : 11, writable : true },
- fontSize : { value : 11, writable : true },
- fontFamily : { value : "monospace", writable : true },
- lineSpacing : { value : 2, writable : true },
- onHide : { value : function(){}, writable : true },
+ onUpdate : { value : null, writable : true },
+ onSelected : { value : null, writable : true },
+ shortcut : { value : null, writable : true },
+ label : { value : ":", writable : true },
+ visibleItems : { value : 11, writable : true },
+ fontSize : { value : 11, writable : true },
+ fontFamily : { value : "monospace", writable : true },
+ lineSpacing : { value : 2, writable : true },
+ onHide : { value : function(){}, writable : true }
});
return Completion;