mirror of
https://github.com/twisterarmy/twister-calm.git
synced 2025-02-04 19:14:30 +00:00
Options fix
This commit is contained in:
parent
9bb2edea97
commit
ee54db4e01
@ -104,18 +104,21 @@ function setTheme() {
|
||||
}
|
||||
|
||||
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() {
|
||||
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'){
|
||||
$('input[type="checkbox"]').prop('disabled', true)
|
||||
$('input[type="checkbox"]').prop('disabled', localStorage['imagesPreviewGif'])
|
||||
}
|
||||
|
||||
if(!localStorage['imagesPreview']) localStorage['imagesPreview'] = "enable";
|
||||
|
||||
$('.previewOpt').on('change', function(){
|
||||
localStorage[this.id] = $(this).val();
|
||||
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 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.append(imagePreview(postLink));
|
||||
}else if(postLink && ytRegExp.test(postLink) && localStorage['youtubePreview'] === 'enable'){
|
||||
@ -310,13 +310,13 @@ function escapeHtmlEntities(str) {
|
||||
function imagePreview(link) {
|
||||
var linkAnon = 'https://ssl-proxy.my-addr.org/myaddrproxy.php/http/';
|
||||
|
||||
if (link && /https:\/\/img.bi/gi.test(link)){
|
||||
return "<img data-imgbi='" + link + "' class='image-preview' />";
|
||||
imgBiJS();
|
||||
if (link && /https:\/\/img.bi/i.test(link)){
|
||||
return '<img data-imgbi="'+link+'" class="image-preview" />';
|
||||
//imgBiJS();
|
||||
}else{
|
||||
var cleanLink = link.replace(/^http[s]?:\/\//i, '');
|
||||
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