Skip to content

Commit

Permalink
Version 2.8:
Browse files Browse the repository at this point in the history
Fixed: Open URL twice when clicked by middle button of mouse. #9
Fixed: Sometimes search will fail. #7
Fixed: Context menu position.
Improved: CSS style.
Added: Placeholder "\_\_VBM_CURRENT_TAB_URL\_\_" in bookmark URL to make some bookmarklets work (Chrome does not allow _document.location.href_ in BMlet). It will be replaced with URL of current active tab when you click BMlet from vBookmarks.
  • Loading branch information
windviki committed May 6, 2019
1 parent 047747b commit a353198
Show file tree
Hide file tree
Showing 65 changed files with 3,882 additions and 3,610 deletions.
Empty file modified .idea/codeStyleSettings.xml
100755 → 100644
Empty file.
Empty file modified .project
100755 → 100644
Empty file.
34 changes: 33 additions & 1 deletion README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ Chinese Introduction
版本2.6 再次修复双滚动条。


版本2.8 修正鼠标中键点击打开两个页面的问题。https://github.com/windviki/vBookmarks/issues/9

修正有时候搜索书签会出现空结果的问题。 https://github.com/windviki/vBookmarks/issues/7

修正右键菜单有时候会被截断的问题。

改进滚动条CSS样式。

添加一个占位符"\_\_VBM_CURRENT_TAB_URL\_\_"。放在URL里可以自动被替换为当前激活的Tab的URL。主要用于Bookmarklet。(Chrome中使用BMLet常用的 _document.location.href_ 会取不到URL)。

比如WIZ的BMLet“添加到WIZ”(http://note.wiz.cn/web/pages/client/url2wiz.html),官方的URL为:

javascript:window.open('http://note.wiz.cn/url2wiz?url=' + encodeURIComponent(document.location.href)+'&folder=%2FMy%20Notes%2F&user=your_email@mywiz.cn&content-only=false&bookmark=1');

现在可以改为:

http://note.wiz.cn/url2wiz?url=\_\_VBM_CURRENT_TAB_URL\_\_&folder=%2FMy%20Notes%2F&user=your_email@mywiz.cn&content-only=false&bookmark=1


注意:

Expand Down Expand Up @@ -296,6 +314,7 @@ Fixed: Scroll bar does not work above chrome 26+ (not well tested).
**ver2.3 2013/04/09**

Fixed: Context menu will be dismissed when scrolling up/down (broken again in previous version).

Fixed: Remember position of scroll bar (broken again in previous version).


Expand All @@ -311,4 +330,17 @@ Fixed: Remove HTML notifications because it is not available now. https://bugs.w

**ver2.6 2013/10/21**

Fixed: Remove double scroll bars.
Fixed: Remove double scroll bars.


**ver2.8 2019/05/06**

Fixed: Open URL twice when clicked by middle button of mouse. https://github.com/windviki/vBookmarks/issues/9

Fixed: Sometimes search will fail. https://github.com/windviki/vBookmarks/issues/7

Fixed: Context menu position.

Improved: Scrollbar CSS style.

Added: Placeholder "\_\_VBM_CURRENT_TAB_URL\_\_" in bookmark URL to make some bookmarklets work (Chrome does not allow _document.location.href_ in BMlet). It will be replaced with URL of current active tab when you click BMlet from vBookmarks.
Empty file modified _locales/en/messages.json
100755 → 100644
Empty file.
Empty file modified _locales/ja/messages.json
100755 → 100644
Empty file.
Empty file modified _locales/zh/messages.json
100755 → 100644
Empty file.
Empty file modified _locales/zh_TW/messages.json
100755 → 100644
Empty file.
52 changes: 27 additions & 25 deletions advanced-options.html
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,40 @@
<script src="codemirror.js"></script>
<script src="advanced-options.js"></script>
<div class="options-nav">
<a href="options.html"><p id="small-options"></p></a>
<a href="options.html">
<p id="small-options"></p>
</a>
</div>
<h1><img src="icon32.png" width="32" height="32" alt=""> <span id="ext-name"></span> <small><span id="advanced-options"></span></small></h1>
<fieldset>
<legend><span id="custom-icon"></span></legend>
<div id="custom-icon-preview"><img src="icon.png" width="19" height="19" alt=""></div>
<p id="custom-icon-description"></p>
<div>
<button id="default-icon-button"></button><span id="default-icon-button-or"></span><input type="file" id="custom-icon-file">
</div>
<legend><span id="custom-icon"></span></legend>
<div id="custom-icon-preview"><img src="icon.png" width="19" height="19" alt=""></div>
<p id="custom-icon-description"></p>
<div>
<button id="default-icon-button"></button><span id="default-icon-button-or"></span><input type="file" id="custom-icon-file">
</div>
</fieldset>
<fieldset>
<legend><span id="custom-styles"></span></legend>
<span id="custom-separator-color-description"></span><input type="text" id="custom-separator-color">
<p></p>
<span id="custom-separator-title-description"></span><input type="text" id="custom-separator-title">
<p></p>
<span id="custom-separator-url-description"></span><input type="text" id="custom-separator-url">
<p></p>
<span id="custom-separator-string-description"></span><input type="text" id="custom-separator-string">
<p></p>
<span id="custom-styles-description"></span><span><a href="http://gist.github.com/">GitHub Gist</a></span>
<p></p>
<textarea id="userstyle"></textarea>
<legend><span id="custom-styles"></span></legend>
<span id="custom-separator-color-description"></span><input type="text" id="custom-separator-color">
<p></p>
<span id="custom-separator-title-description"></span><input type="text" id="custom-separator-title">
<p></p>
<span id="custom-separator-url-description"></span><input type="text" id="custom-separator-url">
<p></p>
<span id="custom-separator-string-description"></span><input type="text" id="custom-separator-string">
<p></p>
<span id="custom-styles-description"></span><span><a href="http://gist.github.com/">GitHub Gist</a></span>
<p></p>
<textarea id="userstyle"></textarea>
</fieldset>
<fieldset>
<legend><span id="reset-settings"></span></legend>
<div><span id="reset-settings-description"></span><button id="reset-button"></button></div>
<legend><span id="reset-settings"></span></legend>
<div><span id="reset-settings-description"></span><button id="reset-button"></button></div>
</fieldset>
<div id="footer">
<p id="options-footer-1"></p>
<p id="options-footer-2"></p>
<p id="options-footer-3"></p>
<p id="options-footer-4"></p>
<p id="options-footer-1"></p>
<p id="options-footer-2"></p>
<p id="options-footer-3"></p>
<p id="options-footer-4"></p>
</div>
250 changes: 128 additions & 122 deletions advanced-options.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,136 +1,142 @@
(function (window) {
var document = window.document;
var chrome = window.chrome;
var _m = chrome.i18n.getMessage;
var __m = _m;
(function(window) {
var document = window.document;
var chrome = window.chrome;
var _m = chrome.i18n.getMessage;
var __m = _m;

document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('DOMContentLoaded', function() {

document.title = _m('extName') + ' ' + _m('advancedOptions');
document.title = _m('extName') + ' ' + _m('advancedOptions');

var customIconPreview = $('custom-icon-preview').firstElementChild;
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 19;
var ctx = canvas.getContext('2d');
var dontLoad = true;
customIconPreview.onload = function () {
if (dontLoad) {
dontLoad = false;
return;
}
ctx.clearRect(0, 0, 19, 19);
ctx.drawImage(customIconPreview, 0, 0, 19, 19);
var imageData = ctx.getImageData(0, 0, 19, 19);
chrome.browserAction.setIcon({imageData: imageData});
localStorage.customIcon = JSON.stringify(imageData.data);
};
if (localStorage.customIcon) {
var customIcon = JSON.parse(localStorage.customIcon);
var imageData = ctx.getImageData(0, 0, 19, 19);
for (var key in customIcon) imageData.data[key] = customIcon[key];
ctx.putImageData(imageData, 0, 0);
customIconPreview.src = canvas.toDataURL();
}
var customIconPreview = $('custom-icon-preview').firstElementChild;
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 19;
var ctx = canvas.getContext('2d');
var dontLoad = true;
customIconPreview.onload = function() {
if (dontLoad) {
dontLoad = false;
return;
}
ctx.clearRect(0, 0, 19, 19);
ctx.drawImage(customIconPreview, 0, 0, 19, 19);
var imageData = ctx.getImageData(0, 0, 19, 19);
chrome.browserAction.setIcon({
imageData: imageData
});
localStorage.customIcon = JSON.stringify(imageData.data);
};
if (localStorage.customIcon) {
var customIcon = JSON.parse(localStorage.customIcon);
var imageData = ctx.getImageData(0, 0, 19, 19);
for (var key in customIcon) imageData.data[key] = customIcon[key];
ctx.putImageData(imageData, 0, 0);
customIconPreview.src = canvas.toDataURL();
}

var customIconFile = $('custom-icon-file');
customIconFile.addEventListener('change', function () {
var files = this.files;
if (files && files.length) {
var file = files[0];
if (/image\/[a-z]+/i.test(file.type)) {
reader = new FileReader();
reader.onload = function (e) {
var result = e.target.result;
customIconPreview.src = result;
};
reader.readAsDataURL(files[0]);
} else {
alert('Not an image. Try another one.');
}
}
});
var customIconFile = $('custom-icon-file');
customIconFile.addEventListener('change', function() {
var files = this.files;
if (files && files.length) {
var file = files[0];
if (/image\/[a-z]+/i.test(file.type)) {
reader = new FileReader();
reader.onload = function(e) {
var result = e.target.result;
customIconPreview.src = result;
};
reader.readAsDataURL(files[0]);
} else {
alert('Not an image. Try another one.');
}
}
});

var defaultIconButton = $('default-icon-button');
defaultIconButton.addEventListener('click', function () {
delete localStorage.customIcon;
chrome.browserAction.setIcon({path: 'icon.png'});
dontLoad = true;
customIconPreview.src = 'icon.png';
});
var defaultIconButton = $('default-icon-button');
defaultIconButton.addEventListener('click', function() {
delete localStorage.customIcon;
chrome.browserAction.setIcon({
path: 'icon.png'
});
dontLoad = true;
customIconPreview.src = 'icon.png';
});

var customSeparatorColor = $('custom-separator-color');
if (localStorage.separatorcolor) customSeparatorColor.value = localStorage.separatorcolor;
customSeparatorColor.addEventListener('change', function () {
localStorage.separatorcolor = customSeparatorColor.value;
});
var customSeparatorColor = $('custom-separator-color');
if (localStorage.separatorcolor) customSeparatorColor.value = localStorage.separatorcolor;
customSeparatorColor.addEventListener('change', function() {
localStorage.separatorcolor = customSeparatorColor.value;
});

var customSeparatorTitle = $('custom-separator-title');
if (localStorage.separatorTitle) {
customSeparatorTitle.value = localStorage.separatorTitle;
} else {
customSeparatorTitle.value = '|';
}
customSeparatorTitle.addEventListener('change', function () {
localStorage.separatorTitle = customSeparatorTitle.value;
});
var customSeparatorTitle = $('custom-separator-title');
if (localStorage.separatorTitle) {
customSeparatorTitle.value = localStorage.separatorTitle;
} else {
customSeparatorTitle.value = '|';
}
customSeparatorTitle.addEventListener('change', function() {
localStorage.separatorTitle = customSeparatorTitle.value;
});

var customSeparatorUrl = $('custom-separator-url');
if (localStorage.separatorUrl) {
customSeparatorUrl.value = localStorage.separatorUrl;
} else {
customSeparatorUrl.value = 'http://separatethis.com/';
}
customSeparatorUrl.addEventListener('change', function () {
localStorage.separatorUrl = customSeparatorUrl.value;
});
var customSeparatorUrl = $('custom-separator-url');
if (localStorage.separatorUrl) {
customSeparatorUrl.value = localStorage.separatorUrl;
} else {
customSeparatorUrl.value = 'http://separatethis.com/';
}
customSeparatorUrl.addEventListener('change', function() {
localStorage.separatorUrl = customSeparatorUrl.value;
});

var customSeparatorString = $('custom-separator-string');
if (localStorage.separatorString) {
customSeparatorString.value = localStorage.separatorString;
} else {
customSeparatorString.value = "separatethis.com;"
}
customSeparatorString.addEventListener('change', function () {
localStorage.separatorString = customSeparatorString.value;
});
var customSeparatorString = $('custom-separator-string');
if (localStorage.separatorString) {
customSeparatorString.value = localStorage.separatorString;
} else {
customSeparatorString.value = "separatethis.com;"
}
customSeparatorString.addEventListener('change', function() {
localStorage.separatorString = customSeparatorString.value;
});

var textareaUserstyle = $('userstyle');
if (localStorage.userstyle) textareaUserstyle.value = localStorage.userstyle;
CodeMirror.fromTextArea(textareaUserstyle, {
onChange: function (c) {
localStorage.userstyle = c.getValue();
}
});
var textareaUserstyle = $('userstyle');
if (localStorage.userstyle) textareaUserstyle.value = localStorage.userstyle;
CodeMirror.fromTextArea(textareaUserstyle, {
onChange: function(c) {
localStorage.userstyle = c.getValue();
}
});

$('reset-button').addEventListener('click', function () {
localStorage.clear();
alert('vBookmarks has been reset.');
location.reload();
}, false);
$('reset-button').addEventListener('click', function() {
localStorage.clear();
alert('vBookmarks has been reset.');
location.reload();
}, false);

window.onerror = function () {
chrome.extension.sendRequest({error: [].slice.call(arguments)})
};
window.onerror = function() {
chrome.extension.sendRequest({
error: [].slice.call(arguments)
})
};

document.getElementById('small-options').innerText = __m('options');
document.getElementById('ext-name').innerText = __m('extName');
document.getElementById('advanced-options').innerText = __m('advancedOptions');
document.getElementById('custom-icon').innerText = __m('customIcon');
document.getElementById('custom-icon-description').innerText = __m('customIconDescription');
document.getElementById('default-icon-button').innerText = __m('defaultIconButton');
document.getElementById('default-icon-button-or').innerText = __m('defaultIconButtonOr');
document.getElementById('custom-styles').innerText = __m('customStyles');
document.getElementById('custom-separator-color-description').innerText = __m('customSeparatorColorDescription');
document.getElementById('custom-separator-title-description').innerText = __m('customSeparatorTitleDescription');
document.getElementById('custom-separator-url-description').innerText = __m('customSeparatorUrlDescription');
document.getElementById('custom-separator-string-description').innerText = __m('customSeparatorStringDescription');
document.getElementById('custom-styles-description').innerText = __m('customStylesDescription');
document.getElementById('reset-settings').innerText = __m('resetSettings');
document.getElementById('reset-settings-description').innerText = __m('resetSettingsDescription');
document.getElementById('reset-button').innerText = __m('resetButton');
document.getElementById('options-footer-1').innerHTML = '<a href="http://twitter.com/cheeaun">' + __m('optionsFooterText', 'Lim Chee Aun') + '</a>';
document.getElementById('options-footer-2').innerHTML = '<a href="http://twitter.com/windviki">' + __m('optionsFooterText', 'windviki') + '</a>';
document.getElementById('options-footer-3').innerHTML = '<a href="http://weibo.com/windviki">Follow @windviki on Weibo</a>';
document.getElementById('options-footer-4').innerHTML = '<a href="http://windviki.github.com/vBookmarks/">vBookmarks Mainpage (docs and source code)</a>';
});
document.getElementById('small-options').innerText = __m('options');
document.getElementById('ext-name').innerText = __m('extName');
document.getElementById('advanced-options').innerText = __m('advancedOptions');
document.getElementById('custom-icon').innerText = __m('customIcon');
document.getElementById('custom-icon-description').innerText = __m('customIconDescription');
document.getElementById('default-icon-button').innerText = __m('defaultIconButton');
document.getElementById('default-icon-button-or').innerText = __m('defaultIconButtonOr');
document.getElementById('custom-styles').innerText = __m('customStyles');
document.getElementById('custom-separator-color-description').innerText = __m('customSeparatorColorDescription');
document.getElementById('custom-separator-title-description').innerText = __m('customSeparatorTitleDescription');
document.getElementById('custom-separator-url-description').innerText = __m('customSeparatorUrlDescription');
document.getElementById('custom-separator-string-description').innerText = __m('customSeparatorStringDescription');
document.getElementById('custom-styles-description').innerText = __m('customStylesDescription');
document.getElementById('reset-settings').innerText = __m('resetSettings');
document.getElementById('reset-settings-description').innerText = __m('resetSettingsDescription');
document.getElementById('reset-button').innerText = __m('resetButton');
document.getElementById('options-footer-1').innerHTML = '<a href="http://twitter.com/cheeaun">' + __m('optionsFooterText', 'Lim Chee Aun') + '</a>';
document.getElementById('options-footer-2').innerHTML = '<a href="http://twitter.com/windviki">' + __m('optionsFooterText', 'windviki') + '</a>';
document.getElementById('options-footer-3').innerHTML = '<a href="http://weibo.com/windviki">Follow @windviki on Weibo</a>';
document.getElementById('options-footer-4').innerHTML = '<a href="http://windviki.github.com/vBookmarks/">vBookmarks Mainpage (docs and source code)</a>';
});
})(window);
Empty file modified background.html
100755 → 100644
Empty file.

0 comments on commit a353198

Please sign in to comment.