Tieba Fix for Opera

Opera贴吧修复 - Gerald倾情打造

  1. // ==UserScript==
  2. // @name Tieba Fix for Opera
  3. // @namespace http://gera2ld.blog.163.com/
  4. // @author Gerald <gera2ld@163.com>
  5. // @icon http://s.gravatar.com/avatar/a0ad718d86d21262ccd6ff271ece08a3?s=80
  6. // @version 1.3.1
  7. // @description Opera贴吧修复 - Gerald倾情打造
  8. // @homepage http://userscripts.org/scripts/show/153687
  9. // @include http://tieba.baidu.com/*
  10. // @exclude http://tieba.baidu.com/tb/*
  11. // @require https://gf.qytechs.cn/scripts/144/code.user.js
  12. // ==/UserScript==
  13.  
  14. // 修复光标
  15. function initCursorFix(editor) {
  16. UE.browser.opera=null;
  17. UE.browser.ie=true;
  18. UE.browser.ie9above=true;
  19. }
  20. // 修复粘贴功能
  21. function initPasteFix() {
  22. $('<div id=baidu_pastebin>').appendTo(document.body);
  23. }
  24. // 修复上传图片错误
  25. function initImageUpdateFix() {
  26. var loadingURL='http://tb2.bdstatic.com/tb/static-postor/images/loading_33e098e1.gif';
  27. unsafeWindow._.Module.use('common/component/image_uploader_manager',{},function(b){
  28. utils.hook(b.__proto__,'_startImageUploader',{after:function(){
  29. var i=$('<input type=file style="opacity:0">'),m=null;
  30. this._options.container.html(i);
  31. if(!('uploadImage' in utils)) m='请先安装贴吧图化脚本(http://userscripts.org/scripts/show/156579)才能上传本地图片!';
  32. else if(!utils.uploadImage) m='图片上传功能初始化失败,请在图化按钮中重试!';
  33. if(m) i.click(function(e){e.preventDefault();alert(m);});
  34. else i.change(function(e){
  35. var r=new FileReader(),i=document.createElement('img');
  36. i.src=loadingURL;test_editor.selection._bakRange.insertNode(i);
  37. r.onload=function(){utils.uploadImage(this.result,i);};
  38. r.readAsDataURL(e.target.files[0]);
  39. });
  40. }});
  41. });
  42. }
  43.  
  44. if(unsafeWindow.PosterContext&&unsafeWindow.PosterContext.isPostAllowed()) {
  45. utils.wait(unsafeWindow,'test_editor',initCursorFix); // 修复光标
  46. initPasteFix(); // 修复粘贴功能
  47. initImageUpdateFix(); // 修复上传图片错误
  48. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址