123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- (function ($) {
- $.fn.khjPageLink = function () {
- var _this = $(this);
-
- _this.bind("mousedown", function () {
- $(this).addClass("pageLink_push");
- });
-
- _this.bind("mouseup", function () {
- $(this).removeClass("pageLink_push");
- });
-
- _this.bind("mouseleave", function () {
- $(this).removeClass("pageLink_push");
- });
- };
-
- $.fn.khjAccordion = function () {
- var _this = $(this);
-
- _this.bind("click", function () {
- $(this).parent().parent().find(".body").toggle();
- });
-
- _this.khjToggleBtn();
- };
- $.fn.khjToggleBtn = function () {
- var _this = $(this),
- src = null,
- value = null;
-
- _this.each(function () {
- value = {};
- src = "";
-
- value.obj = $(this);
- value.mode = 0;
-
- src = value.obj.attr("src");
-
- value.nSrc = [src, src.replace("_N", "_SN")];
- value.oSrc = [src.replace("_N", "_O"), src.replace("_N", "_SO")];
- value.pSrc = [src.replace("_N", "_P"), src.replace("_N", "_SP")];
- value.dSrc = [src.replace("_N", "_D"), src.replace("_N", "_SD")];
-
- value.obj.data("value", value);
- });
-
- _this.bind("mouseover", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.oSrc[value.mode]);
- });
-
- _this.bind("mousedown", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.pSrc[value.mode]);
- });
- _this.bind("mouseup", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.oSrc[value.mode]);
- });
- _this.bind("mouseleave", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.nSrc[value.mode]);
- });
-
- _this.bind("click", function () {
- var value = $(this).data("value");
- value.mode = value.mode?0:1;
- value.obj.attr("src", value.oSrc[value.mode]);
- });
- };
-
- $.fn.khjImgButton = function () {
- var _this = $(this),
- src = null,
- value = null;
-
- _this.each(function () {
- value = {};
- src = "";
-
- value.obj = $(this);
-
- src = value.obj.attr("src");
-
- value.nSrc = src;
- value.oSrc = src.replace("_N", "_O");
- value.pSrc = src.replace("_N", "_P");
- value.dSrc = src.replace("_N", "_D");
-
- value.obj.data("value", value);
- });
-
- _this.bind("mouseover", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.oSrc);
- });
-
- _this.bind("mousedown", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.pSrc);
- });
- _this.bind("mouseup", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.oSrc);
- });
- _this.bind("mouseleave", function () {
- var value = $(this).data("value");
- value.obj.attr("src", value.nSrc);
- });
- };
- $.fn.khjSelectBox = function () {
- var _this = $(this),
- value = null;
-
- _this.each(function () {
- value = {};
-
- value.obj = $(this);
- value.text = value.obj.find(".selectTxt");
- value.btn = value.obj.find(".selectBtn");
- value.wrap = value.obj.find(".optionWrap");
- value.items = value.wrap.find("li");
-
- value.obj.data("value", value);
-
- if (value.items.size() > 5) value.wrap.css("height", "150px");
-
- value.btn.bind("click", function () {
- var value = $(this).parent().data("value");
- value.wrap.toggle();
- });
-
- value.obj.bind("mouseleave", function () {
- var value = $(this).data("value");
- value.wrap.hide();
- });
- value.items.bind("click", function () {
- var _this = $(this),
- value = _this.parent().parent().parent().data("value");
-
- value.text.html(_this.html());
- value.wrap.hide();
- });
-
- value.items.bind("mouseover", function () {
- $(this).addClass("on");
- });
- value.items.bind("mouseleave", function () {
- $(this).removeClass("on");
- });
-
- value.btn.khjImgButton();
- });
- };
-
- $.fn.khjSlider = function (value) {
- var _this = $(this),
- flag = false,
- txt = _this.find(".txt"),
- wrap = _this.find(".slider"),
- bg = _this.find(".sliderFull"),
- ball = _this.find(".ball"),
- width = wrap.width() - 20,
- old = 0,
- margin = 0,
- left = 0,
- per = width/100;
-
- if (value == undefined) value = txt.html();
-
- ball.khjImgButton();
-
- left = Math.ceil(per*value);
- ball.css("left", left);
- bg.css("width", left);
- txt.html(value);
-
- ball.get(0).ondragstart = function() { return false; };
-
- ball.bind("mousedown", function (e) {
- flag = true;
- old = e.pageX;
- e.stopPropagation();
- });
-
- $(document).bind("mousemove", function (e) {
- if (flag) {
- margin = e.pageX - old;
- left += margin;
-
- if (left >= width) left = width;
- if (left <= 0) left = 0;
-
- ball.css("left", left);
- bg.css("width", left);
- txt.html(Math.ceil(left/per));
- if(txt.prop("id") == "viewSizeSlider"){
- setviewsize(txt.html());
- }
- else if(txt.prop("id") == "bufferingSlider"){
- display_buff_change(txt.html());
- }
- old = e.pageX;
- }
- });
-
- $(document).bind("mouseup", function (e) {
- flag = false;
- });
- $(document).bind("mouseleave", function (e) {
- flag = false;
- });
- };
-
- $.fn.khjMenu = function () {
- var _this = $(this),
- src = null,
- value = null,
- on = _this.parent().filter(".on");
- _this.khjTxtToggleBtn();
-
- _this.bind("click", function () {
- $(this).parent().toggleClass("on");
- });
-
- on.removeClass("on");
- on.find(".menu img").trigger("click");
- };
-
- $.fn.khjTxtButton = function () {
- var _this = $(this),
- src = null,
- value = null;
-
- _this.each(function () {
- value = {};
- src = "";
-
- value.obj = $(this);
- value.img = value.obj.find("img");
- value.span = value.obj.find("span");
-
- src = value.img.attr("src");
- value.nSrc = src;
- value.oSrc = src.replace("_N", "_O");
- value.pSrc = src.replace("_N", "_P");
- value.dSrc = src.replace("_N", "_D");
-
- value.obj.data("value", value);
- });
- _this.bind("mouseover", function () {
- var value = $(this).data("value");
- value.img.attr("src", value.oSrc);
- });
-
- _this.bind("mousedown", function () {
- var value = $(this).data("value");
- value.span.addClass("p");
- value.img.attr("src", value.pSrc);
- });
- _this.bind("mouseup", function () {
- var value = $(this).data("value");
- value.span.removeClass("p");
- value.img.attr("src", value.oSrc);
- });
- _this.bind("mouseleave", function () {
- var value = $(this).data("value");
- value.span.removeClass("p");
- value.img.attr("src", value.nSrc);
- });
- };
- $.fn.khjSubMenuButton = function () {
- var _this = $(this),
- src = null,
- value = null;
-
- _this.each(function () {
- value = {};
- src = "";
-
- value.obj = $(this);
- value.img = value.obj.find("img");
- value.span = value.obj.find("span");
-
- src = value.img.attr("src");
- value.nSrc = src;
- value.oSrc = src.replace("_N", "_O");
- value.pSrc = src.replace("_N", "_P");
- value.dSrc = src.replace("_N", "_D");
-
- value.obj.data("value", value);
- });
- _this.bind("mouseover", function () {
- var value = $(this).data("value");
- value.img.attr("src", value.oSrc);
- });
-
- _this.bind("mousedown", function () {
- var value = $(this).data("value");
- value.span.addClass("p");
- value.img.attr("src", value.pSrc);
- });
- _this.bind("mouseup", function () {
- var value = $(this).data("value");
- value.span.removeClass("p");
- value.img.attr("src", value.oSrc);
- });
- _this.bind("mouseleave", function () {
- var value = $(this).data("value");
- value.span.removeClass("p");
- value.img.attr("src", value.nSrc);
- });
- _this.bind("click", function () {
- var id = $(this).attr("id").slice(1);
- T_SelectMenu(id);
- });
- };
-
- $.fn.khjTxtToggleBtn = function () {
- var _this = $(this),
- src = null,
- value = null;
-
- _this.each(function () {
- value = {};
- src = "";
-
- value.obj = $(this);
- value.img = value.obj.find("img");
- value.span = value.obj.find("span");
- value.mode = 0;
-
- src = value.img.attr("src");
- value.nSrc = [src, src.replace("_N", "_SN")];
- value.oSrc = [src.replace("_N", "_O"), src.replace("_N", "_SO")];
- value.pSrc = [src.replace("_N", "_P"), src.replace("_N", "_SP")];
- value.dSrc = [src.replace("_N", "_D"), src.replace("_N", "_SD")];
-
- value.obj.data("value", value);
- });
- _this.bind("mouseover", function () {
- var value = $(this).data("value");
- value.img.attr("src", value.oSrc[value.mode]);
- });
-
- _this.bind("mousedown", function () {
- var value = $(this).data("value");
- value.span.addClass("p");
- value.img.attr("src", value.pSrc[value.mode]);
- });
- _this.bind("mouseup", function () {
- var value = $(this).data("value");
- value.span.removeClass("p");
- value.img.attr("src", value.oSrc[value.mode]);
- });
- _this.bind("mouseleave", function () {
- var value = $(this).data("value");
- value.span.removeClass("p");
- value.img.attr("src", value.nSrc[value.mode]);
- });
-
- _this.bind("click", function () {
- var value = $(this).data("value");
- value.mode = value.mode?0:1;
- value.img.attr("src", value.oSrc[value.mode]);
- });
- };
-
- $.extend({
- changeWidth : function (margin) {
- // $(".wrapWidth").css("width", "+=" + margin);
- // $(".viewWidth").css("width", "+=" + margin);
- $(".wrapWidth").css("width", margin+201);
- $(".viewWidth").css("width", margin);
- },
- changeSetupWidth : function (margin) {
- // $(".wrapWidth").css("width", "+=" + margin);
- // $(".viewWidth").css("width", "+=" + margin);
- $(".wrapWidth").css("width", margin+301);
- $(".viewWidth").css("width", margin+61);
- },
- khjDisable : function (id, num) {
- var _this = $("#" + id),
- value = _this.data("value"),
- dSrc = null,
- btn = null;
- if (!value) {
- value = _this.find(".ball").data("value");
- }
-
- dSrc = value.dSrc;
-
- if (num != undefined) dSrc = value.dSrc[num];
-
- if (dSrc) {
- if (value.img != undefined) {
- value.img.attr("src", dSrc);
- value.span.addClass("d");
- } else {
- value.obj.attr("src", dSrc);
- }
- } else {
- btn = value.btn.data("value");
-
- dSrc = btn.dSrc;
- value.btn.attr("src", dSrc);
- value.btn.unbind("mouseover mouseleave mouseup mousedown click");
- }
-
- value.obj.unbind("mouseover mouseleave mouseup mousedown click");
- }
- });
- })(jQuery);
|