mirror of
https://github.com/twisterarmy/twister-calm.git
synced 2025-02-10 05:54:21 +00:00
Options fix
This commit is contained in:
parent
9bb2edea97
commit
ee54db4e01
@ -104,18 +104,21 @@ function setTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setShowPreviewOpt(){
|
function setShowPreviewOpt(){
|
||||||
|
if(!localStorage['imagesPreview']) localStorage['imagesPreview'] = 'enable';
|
||||||
|
if(!localStorage['imagesPreviewGif']) localStorage['imagesPreviewGif'] = 'true';
|
||||||
|
if(!localStorage['youtubePreview']) localStorage['youtubePreview'] = 'enable';
|
||||||
|
if(!localStorage['vimeoPreview']) localStorage['vimeoPreview'] = 'enable';
|
||||||
|
|
||||||
$('.previewOpt').each(function() {
|
$('.previewOpt').each(function() {
|
||||||
this.value = localStorage[this.id] || 'enable';
|
this.value = localStorage[this.id];
|
||||||
})
|
})
|
||||||
|
|
||||||
$('input[type="checkbox"]').prop('checked', localStorage['imagesPreviewGif'] == 'true')
|
$('.gifCheckBox').prop('checked', localStorage['imagesPreviewGif'] === 'true')
|
||||||
|
|
||||||
if(localStorage['imagesPreview'] == 'disable'){
|
if(localStorage['imagesPreview'] == 'disable'){
|
||||||
$('input[type="checkbox"]').prop('disabled', true)
|
$('input[type="checkbox"]').prop('disabled', localStorage['imagesPreviewGif'])
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!localStorage['imagesPreview']) localStorage['imagesPreview'] = "enable";
|
|
||||||
|
|
||||||
$('.previewOpt').on('change', function(){
|
$('.previewOpt').on('change', function(){
|
||||||
localStorage[this.id] = $(this).val();
|
localStorage[this.id] = $(this).val();
|
||||||
if (this.id === 'imagesPreview'){
|
if (this.id === 'imagesPreview'){
|
||||||
|
@ -107,7 +107,7 @@ function postToElem( post, kind ) {
|
|||||||
var ytRegExp = /(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?/i;
|
var ytRegExp = /(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?/i;
|
||||||
var vimeoRegExp = /http:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/i;
|
var vimeoRegExp = /http:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/i;
|
||||||
|
|
||||||
if (postLink && localStorage['imagesPreview'] == 'enable' && (/(\.jpg)|(\.gif)|(\.png)|(\.jpeg)|(\.jpe)/i.test(postLink) || /https:\/\/img.bi/gi.test(postLink))){
|
if (postLink && localStorage['imagesPreview'] == 'enable' && (/(\.jpg)|(\.gif)|(\.png)|(\.jpeg)|(\.jpe)/i.test(postLink) || /https:\/\/img.bi/i.test(postLink))){
|
||||||
previewContainer.show();
|
previewContainer.show();
|
||||||
previewContainer.append(imagePreview(postLink));
|
previewContainer.append(imagePreview(postLink));
|
||||||
}else if(postLink && ytRegExp.test(postLink) && localStorage['youtubePreview'] === 'enable'){
|
}else if(postLink && ytRegExp.test(postLink) && localStorage['youtubePreview'] === 'enable'){
|
||||||
@ -310,13 +310,13 @@ function escapeHtmlEntities(str) {
|
|||||||
function imagePreview(link) {
|
function imagePreview(link) {
|
||||||
var linkAnon = 'https://ssl-proxy.my-addr.org/myaddrproxy.php/http/';
|
var linkAnon = 'https://ssl-proxy.my-addr.org/myaddrproxy.php/http/';
|
||||||
|
|
||||||
if (link && /https:\/\/img.bi/gi.test(link)){
|
if (link && /https:\/\/img.bi/i.test(link)){
|
||||||
return "<img data-imgbi='" + link + "' class='image-preview' />";
|
return '<img data-imgbi="'+link+'" class="image-preview" />';
|
||||||
imgBiJS();
|
//imgBiJS();
|
||||||
}else{
|
}else{
|
||||||
var cleanLink = link.replace(/^http[s]?:\/\//i, '');
|
var cleanLink = link.replace(/^http[s]?:\/\//i, '');
|
||||||
if(/\.gif\b/i.test(cleanLink) && localStorage['imagesPreviewGif'] == 'false') return;
|
if(/\.gif\b/i.test(cleanLink) && localStorage['imagesPreviewGif'] == 'false') return;
|
||||||
return "<img src='"+linkAnon+cleanLink+"' class='image-preview' />";
|
return '<img src="'+linkAnon+cleanLink+'" class="image-preview" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user