Permalink
Browse files

add panel position alignment

  • Loading branch information...
kidwm committed Aug 9, 2013
1 parent 272a83e commit cc3f8629f96490d04c8953e5dee67aa673dd4089
Showing with 52 additions and 12 deletions.
  1. BIN dictionary-panel.xpi
  2. +29 −10 lib/main.js
  3. +23 −2 package.json
View
Binary file not shown.
View
@@ -1,18 +1,37 @@
var self = require("self");
var contextMenu = require("context-menu");
var preference = require('simple-prefs');
var alignment = preference.prefs['alignment'];
const data = self.data;
const positions = {
C: {},
L: {left: 0, bottom: 0},
R: {right: 0, bottom: 0}
};
var position = positions[alignment];
preference.on("alignment", function() {
alignment = preference.prefs['alignment'];
position = positions[alignment];
setpanel();
});
var panel;
function setpanel() {
panel = require("panel").Panel({
width: 680,
height: 550,
position: position,
contentURL: data.url("loading.html"),
onHide: function() {
panel.contentURL = data.url("loading.html");
}
});
}
setpanel();
exports.main = function(options, callbacks) {
var panel = require("panel").Panel({
width: 680,
height: 550,
contentURL: data.url("loading.html"),
onHide: function() {
panel.contentURL = data.url("loading.html");
}
});
var widget = require("widget").Widget({
id: "kimo",
label: "奇摩字典",
View
@@ -2,8 +2,29 @@
"name": "dictionary-panel",
"license": "MPL 2.0",
"author": "kidwm",
"version": "0.2.1",
"version": "0.3",
"fullName": "Dictionary Panel",
"id": "jid1-efsrvlFOR8ZWKw",
"description": "Display the dictionary queried result of selection text in a panel."
"description": "Display the dictionary queried result of selection text in a panel.",
"preferences": [{
"name": "alignment",
"title": "Alignment",
"description": "The Panel Position",
"type": "radio",
"value": "C",
"options": [
{
"value": "L",
"label": "Left"
},
{
"value": "C",
"label": "Center"
},
{
"value": "R",
"label": "Right"
}
]
}]
}

0 comments on commit cc3f862

Please sign in to comment.