@xiee/utils
Version:
Miscellaneous tools and utilities to manipulate HTML pages
2 lines (1 loc) • 1.15 kB
JavaScript
jQuery.fn.disableTextSelect=function(){return this.each(function(){$(this).css({MozUserSelect:"none",webkitUserSelect:"none"}).attr("unselectable","on").bind("selectstart",function(){return false})})};jQuery.fn.enableTextSelect=function(){return this.each(function(){$(this).css({MozUserSelect:"",webkitUserSelect:""}).attr("unselectable","off").unbind("selectstart")})};$(document).ready(function(){var e=$("td.docs");var t=$("td.code");var n=$("div.handler");n.css("height",$("table").css("height"));n.css("left",t.offset().left);var r=parseInt(e.css("padding-right"));var i=parseInt(e.css("padding-left"));var s=parseInt(n.css("width"));n.mousedown(function(){$("body").disableTextSelect();$(document).bind("mousemove",function(o){var u=o.pageX-e.offset().left-r-i-.5*s;e.width(u);n.css("left",t.offset().left)}).mouseup(function(){$("body").enableTextSelect();$(document).unbind("mousemove")})});var o="both";$(document).keydown(function(r){if(r.which==84){switch(o){case"both":t.hide(500);n.hide();o="left";break;case"left":t.show(500);e.hide(500);o="right";break;case"right":t.show(500);e.show(500);n.show(500);o="both";break;default:break}}})});