“MediaWiki:Gadget-wikiaupload.js”的版本间的差异
来自小鱼君和他的朋友们
小 ([InPageEdit]) |
([InPageEdit] 没有编辑摘要) |
||
第25行: | 第25行: | ||
return; | return; | ||
} else { | } else { | ||
− | window.open("https:// | + | window.open("https://epbureau.fandom.com/wiki/Special:Filepath/" + encodeURIComponent(FileName) ); |
} | } | ||
}); | }); | ||
第34行: | 第34行: | ||
return; | return; | ||
} else { | } else { | ||
− | $('#wikiaupload #preview-area').html('<div id="inset"><span id="close-btn">[<a href="#PoweredByDF" onclick="$(\'#wikiaupload #preview-area #inset\').remove()">关闭预览</a>]</span><img id="preview-img" src="https:// | + | $('#wikiaupload #preview-area').html('<div id="inset"><span id="close-btn">[<a href="#PoweredByDF" onclick="$(\'#wikiaupload #preview-area #inset\').remove()">关闭预览</a>]</span><img id="preview-img" src="https://epbureau.fandom.com/wiki/Special:Filepath/' + FileName + '"/><br clear=both /><span id="preview-filename">正在预览: ' + FileName + '<img id="loading-icon" src="https://vignette.wikia.nocookie.net/dftest/images/8/8c/Ms-loading-spinner.svg"/></span></div>'); |
$('#wikiaupload #preview-area #preview-img') | $('#wikiaupload #preview-area #preview-img') | ||
.load(function(){ | .load(function(){ | ||
第54行: | 第54行: | ||
return; | return; | ||
} else { | } else { | ||
− | $('#wpUploadFileURL').val('https:// | + | $('#wpUploadFileURL').val('https://epbureau.fandom.com/wiki/Special:Filepath/' + encodeURIComponent(FileName) ); |
} | } | ||
}); | }); | ||
}); | }); |
2019年12月4日 (三) 02:36的最新版本
/** * WikiaUpload小工具 * 从万界规划局 https://wjghj.fandom.com 快速转存图片 **/ $(function() { // Variables var FileName; $('.page-Special_上传文件 #mw-content-text').prepend('<div id="wikiaupload"><h2>从Fandom获取文件</h2><center id="input-area"><input id="filename-input" rows="1" placeholder="请输入文件名"></center><hr/><center id="button-area"> <button id="openfile-btn">从Fandom获取文件</button> <button id="preview-btn">预览</button> </center><center id="preview-area"></center></div><h2>文件上传表格</h2>'); // Check if default file name exist if ($('#wpDestFile').val() !== '' || $('#wpDestFile').val() !== undefined) { $('#filename-input').val($('#wpDestFile').val()); FileName = $('#wpDestFile').val(); } // Refresh when input $('#wikiaupload #filename-input').keyup(function() { FileName = $('#wikiaupload #filename-input').val(); }); // Open file btn $('#openfile-btn').click(function() { if (FileName === '' || FileName === undefined) { return; } else { window.open("https://epbureau.fandom.com/wiki/Special:Filepath/" + encodeURIComponent(FileName) ); } }); // Preview btn $('#wikiaupload #preview-btn').click(function() { if (FileName === '' || FileName === undefined) { return; } else { $('#wikiaupload #preview-area').html('<div id="inset"><span id="close-btn">[<a href="#PoweredByDF" onclick="$(\'#wikiaupload #preview-area #inset\').remove()">关闭预览</a>]</span><img id="preview-img" src="https://epbureau.fandom.com/wiki/Special:Filepath/' + FileName + '"/><br clear=both /><span id="preview-filename">正在预览: ' + FileName + '<img id="loading-icon" src="https://vignette.wikia.nocookie.net/dftest/images/8/8c/Ms-loading-spinner.svg"/></span></div>'); $('#wikiaupload #preview-area #preview-img') .load(function(){ // If image exist $('#wikiaupload #preview-area #preview-img').css({'background':'#fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGElEQVQYV2N4DwX/oYBhgARgDJjEAAkAAEC99wFuu0VFAAAAAElFTkSuQmCC) repeat','border-bottom':'4px solid #1c840f'}); $('#wikiaupload #preview-area #loading-icon').attr('src','https://wjghj.cn/images/f/fe/Yes_mark.png'); }) .error(function(){ // If not $('#wikiaupload #preview-area #preview-img').attr('src','/images/7/71/Help.jpeg').css({'border-bottom':'4px solid #e11212'}).unbind(); $('#wikiaupload #preview-area #preview-filename').html('加载出错: ' + FileName + ' 可能不存在<img id="error-icon" src="https://wjghj.cn/images/3/35/No_mark.png"/>').css({'color':'#b00','font-weight':'bold'}); }); } }); // Auto input image url $('#wpSourceTypeurl').click(function() { if (FileName === '' || FileName === undefined) { return; } else { $('#wpUploadFileURL').val('https://epbureau.fandom.com/wiki/Special:Filepath/' + encodeURIComponent(FileName) ); } }); });