Browse Source

Minor fix

Gerald 10 years ago
parent
commit
049a665a8e
7 changed files with 19 additions and 6 deletions
  1. 3 1
      gulpfile.js
  2. 1 0
      package.json
  3. 1 1
      src/options/style.css
  4. 3 0
      src/popup/app.js
  5. 5 3
      src/popup/style.css
  6. 1 0
      src/popup/views/item.js
  7. 5 1
      src/popup/views/menu.js

+ 3 - 1
gulpfile.js

@@ -93,7 +93,7 @@ gulp.task('copy-i18n', function () {
   .pipe(gulp.dest('dist'));
 });
 
-gulp.task('default', ['templates', 'js-options', 'js-popup', 'copy-files', 'copy-i18n']);
+gulp.task('build', ['templates', 'js-options', 'js-popup', 'copy-files', 'copy-i18n']);
 
 gulp.task('i18n', function () {
   return gulp.src(paths.locales)
@@ -106,3 +106,5 @@ gulp.task('i18n', function () {
   }))
   .pipe(gulp.dest('src'));
 });
+
+gulp.task('default', ['build']);

+ 1 - 0
package.json

@@ -2,6 +2,7 @@
   "name": "Violentmonkey",
   "version": "2.2.0",
   "scripts": {
+    "develop": "gulp build && gulp watch",
     "update": "node scripts/updateLib"
   },
   "description": "Violentmonkey",

+ 1 - 1
src/options/style.css

@@ -169,7 +169,7 @@ fieldset.title {
   right: 0;
   bottom: 0;
   background: #eee;
-  z-index: 1;
+  z-index: 10;
 }
 .frame-header {
   position: absolute;

+ 3 - 0
src/popup/app.js

@@ -50,6 +50,8 @@ BaseView.prototype.initI18n.call(window);
         return new MenuItem({
           name: menu[0],
           symbol: 'fa-hand-o-right',
+          title: true,
+          className: 'ellipsis',
           onClick: commandClick,
         });
       }));
@@ -64,6 +66,7 @@ BaseView.prototype.initI18n.call(window);
             data: script.enabled,
             symbol: scriptSymbol,
             title: true,
+            className: 'ellipsis',
             onClick: scriptClick,
           });
         }));

+ 5 - 3
src/popup/style.css

@@ -9,17 +9,19 @@ body {
 }
 .menu {
   max-width: 300px;
-  overflow-x: hidden;
   overflow-y: auto;
-  white-space: nowrap;
-  text-overflow: ellipsis;
 }
 .fa {
   width: 1em;
 }
+.ellipsis {
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
 .menu-item {
   cursor: pointer;
   padding: 5px;
+  white-space: nowrap;
 }
 .menu-item:hover {
   background: cornflowerblue;

+ 1 - 0
src/popup/views/item.js

@@ -16,6 +16,7 @@ var MenuItemView = BaseView.extend({
     .attr('title', it.title === true ? it.name : it.title);
     if (it.data === false) this.$el.addClass('disabled');
     else this.$el.removeClass('disabled');
+    if (it.className) this.$el.addClass(it.className);
   },
   onClick: function (e) {
     var onClick = this.model.get('onClick');

+ 5 - 1
src/popup/views/menu.js

@@ -21,7 +21,11 @@ var MenuView = MenuBaseView.extend({
           currentWindow: true,
           url: url,
         }, function (tabs) {
-          if (tabs[0]) chrome.tabs.update(tabs[0].id, {active: true});
+          var tab = _.find(tabs, function (tab) {
+            var hash = tab.url.match(/#(\w+)/);
+            return !hash || !_.includes(['confirm'], hash[1]);
+          });
+          if (tab) chrome.tabs.update(tab.id, {active: true});
           else chrome.tabs.create({url: url});
         });
       },