From a8f2209bb259eb146dd791e0827c02003d60f9fd Mon Sep 17 00:00:00 2001 From: Hedgehog Date: Wed, 11 Jun 2014 14:11:07 +0400 Subject: [PATCH] Added proxy change/disable ability. --- js/options.js | 10 ++++++++-- js/twister_formatpost.js | 5 +++-- options.html | 8 ++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/js/options.js b/js/options.js index 91050b4..f5f435c 100644 --- a/js/options.js +++ b/js/options.js @@ -90,7 +90,7 @@ var TwisterOptions = function() this.keysSend = function() { - $('#keysSend')[0].value = $.Options.getOption('keysSend', 2) + $('#keysSend').val($.Options.getOption('keysSend', 2)); $('#keysSend').on('change', function(){ $.Options.setOption(this.id, this.value); @@ -132,13 +132,19 @@ var TwisterOptions = function() $.Options.setOption(this.name, this.checked) }) } - + this.imgPreviwProxy = function () { + $('#imgPreviewProxy').val($.Options.getOption('imgPreviewProxy', 'disable')); + $('#imgPreviewProxy').on('change', function () { + $.Options.setOption(this.id, this.value); + }) + } this.initOptions = function() { this.soundNotifOptions(); this.volumeControl(); this.keysSend(); this.locLang(); this.showPreviewOpt(); + this.imgPreviwProxy(); } } diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index e70552e..fa3e9b7 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -308,7 +308,8 @@ function escapeHtmlEntities(str) { } function imagePreview(link) { - var linkAnon = 'https://ssl-proxy.my-addr.org/myaddrproxy.php/http/'; + var proxyOpt = $.Options.getOption('imgPreviewProxy', 'disable'); + var linkAnon = proxyOpt !== 'disable' ? proxyOpt : ''; if (link && /https:\/\/img.bi/i.test(link)){ return ''; @@ -316,7 +317,7 @@ function imagePreview(link) { }else{ var cleanLink; if(/\.gif\b/i.test(cleanLink) && $.Options.getOption('imagesPreviewGif', 'true') === 'false') return; - cleanLink = link.replace(/^http[s]?:\/\//i, ''); + cleanLink = link.replace(/^http[s]?:\/\//i, 'http://'); return ''; } } diff --git a/options.html b/options.html index cb07fd9..e71e661 100644 --- a/options.html +++ b/options.html @@ -125,6 +125,14 @@ +
+

Output proxy

+

Images preview

+