Tieba Float Movable

贴吧可移动悬浮窗

Από την 05/03/2014. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name	Tieba Float Movable
// @namespace	http://gera2ld.blog.163.com/
// @author	Gerald <[email protected]>
// @icon	http://s.gravatar.com/avatar/a0ad718d86d21262ccd6ff271ece08a3?s=80
// @version	1.2.6
// @description	贴吧可移动悬浮窗
// @homepage	http://userscripts.org/scripts/show/156576
// @include	http://tieba.baidu.com/*
// @exclude	http://tieba.baidu.com/tb/*
// @require	http://userscripts.org/scripts/source/186749.user.js
// @grant	GM_getValue
// @grant	GM_setValue
// @grant	GM_registerMenuCommand
// ==/UserScript==
function t(t,e){var o={};args.forEach(function(t){o[t]=/^-?\d+px/.test(e[t])?e[t]:"20px"}),t.css(o)}function e(e,o){var i=$(e);i.mousedown&&(e.moving=!1,args=["right","bottom"],i.mousedown(function(n){["DIV","TD"].indexOf(n.target.tagName)<0||"true"==n.target.contentEditable||(n.preventDefault(),n.stopPropagation(),e.x=n.pageX,args.indexOf("left")>=0?e.x-=parseInt(i.css("left")):e.x+=parseInt(i.css("right")),e.y=n.pageY,args.indexOf("top")>=0?e.y-=parseInt(i.css("top")):e.y+=parseInt(i.css("bottom")),e.moving||$(document).mousemove(function(o){if(e.moving){var n={};for(var r in args){var s=args[r];if("left"==s)n[s]=o.pageX-e.x;else if("right"==s)n[s]=e.x-o.pageX;else if("top"==s)n[s]=o.pageY-e.y;else{if("bottom"!=s)continue;n[s]=e.y-o.pageY}n[s]+="px"}t(i,n)}o.preventDefault()}).mouseup(function(){if(e.moving){e.moving=!1;var t={};for(var n in args){var r=args[n];t[r]=i.css(r)}utils.setObj("mcss_"+o,t),$(document).unbind("mousemove").unbind("mouseup")}}),e.moving=!0)}),t(i,utils.getObj("mcss_"+o,{})))}function o(t){$(t).unbind("mousedown").css({left:"",right:"",top:"",bottom:""})}unsafeWindow.PosterContext&&unsafeWindow.PosterContext.isPostAllowed()&&utils.wait(unsafeWindow,"test_editor",function(i){function n(){utils.unminify&&(x.hide(),h.show(),i.focus(),delete utils.unminify)}function r(){h.hide(),x.show(),utils.unminify=n}function s(t){if(t&&(d="dblclick"==t.type?"open"==d?"close":"open":"normal"==d?"open":"normal",utils.setObj("float",d)),!t||"click"==t.type){if("normal"==d)return c.html(""),u.html(""),f.html("<span><em>悬 浮</em></span>"),h.unbind("dblclick"),o(h[0]),h.prop("title",""),m.attr("style",b),w.hide(),void 0;c.html(a),f.html("<span><em>停 靠</em></span>"),y&&h.unbind("dblclick").dblclick(s),e(h[0],"float"),m.prop("style",""),_?(r(),w.show()):(n(),w.hide())}y&&"open"!=d?(u.html("#tb_rich_poster{width:360px;}#tb_rich_poster *{max-width:360px;}#ueditor_replace{min-height:24px !important;width:310px !important;}.poster_success{top:0 !important;left:40px !important;}.editor_bottom_panel,.edui-toolbar{display:none;}.editor_textfield{padding:0 !important;}.old_style_wrapper{width:330px !important;}"),h.attr("title","双击展开")):(u.html("#tb_rich_poster{width:635px;}#tb_rich_poster *{max-width:635px;}#ueditor_replace{min-height:50px !important;}.poster_success{top:50px !important}"),y&&h.attr("title","双击精简"))}function l(){utils.popup.show({html:'<h3>贴吧悬浮窗脚本设置</h3><label><input type=checkbox id=allowMinify>自动隐藏悬浮窗口到右下角</label><br><label style="margin-left:20px;">从右下角呼出快捷键:'+utils.getLink("common",{title:"帮助",html:"(?)"})+'<input id=shortcut style="width:60px"></label><br><label><input type=checkbox id=allowSimple>双击悬浮窗口使其精简或展开</label><br><button id=btReset>重置悬浮窗位置</button>',className:"ge_opt",init:function(e){e.querySelector("#btReset").onclick=function(){t(h,{})};var o=e.querySelector("#allowMinify");o.checked=_,o.onchange=function(){utils.setObj("allowMinify",_=this.checked)},o=e.querySelector("#shortcut"),o.value=g,o.onchange=function(){g&&utils.shortcut(g),g=this.value,p(),GM_setValue("shortcut",g)},o=e.querySelector("#allowSimple"),o.checked=y,o.onchange=function(){utils.setObj("allowSimple",y=this.checked)}},dispose:function(){s()}})}function p(){g&&utils.shortcut(g,n)}var a="#tb_rich_poster{border:3px double grey;position:fixed !important;z-index:1024;background-color:#E7EAEB;}#tb_rich_poster .editor_wrapper{margin-left:2px;}.poster_head,#bdInputObjWrapper,.tb_poster_placeholder,.poster_signature,.poster_draft_status,.poster_reply{display:none !important;}#tb_rich_poster,.editor_bottom_panel{margin-bottom:0 !important;}#tb_rich_poster,.poster_body,.poster_component{padding:0 !important;}",u=utils.addStyle(),c=utils.addStyle(),d=utils.getObj("float","normal"),m=i.$body,h=$("#tb_rich_poster"),b=m.attr("style"),f=utils.addSButton().click(s),g=GM_getValue("shortcut",""),_=utils.getObj("allowMinify",!0),y=utils.getObj("allowSimple",!0),x=$('<div id=btUnminify style="position:fixed;bottom:0;right:0;background:white;padding-top:40px;z-index:10;">◀</div>').appendTo(document.body).hide().mouseover(n),w=$('<div style="position:absolute;top:0;background:inherit;border:1px solid gray;height:100%;cursor:pointer;" title="最小化">▶</div>').appendTo(h).hide().click(r);w.css("left",-w.outerWidth()),s(),p(),GM_registerMenuCommand("悬浮窗设置",l),$(".j_quick_reply").click(n)});