sprintfWrapper = { init : function () { if (typeof arguments == "undefined") { return null; } if (arguments.length < 1) { return null; } if (typeof arguments[0] != "string") { return null; } if (typeof RegExp == "undefined") { return null; } var string = arguments[0]; var exp = new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g); var matches = new Array(); var strings = new Array(); var convCount = 0; var stringPosStart = 0; var stringPosEnd = 0; var matchPosEnd = 0; var newString = ''; var match = null; while (match = exp.exec(string)) { if (match[9]) { convCount += 1; } stringPosStart = matchPosEnd; stringPosEnd = exp.lastIndex - match[0].length; strings[strings.length] = string.substring(stringPosStart, stringPosEnd); matchPosEnd = exp.lastIndex; matches[matches.length] = { match: match[0], left: match[3] ? true : false, sign: match[4] || '', pad: match[5] || ' ', min: match[6] || 0, precision: match[8], code: match[9] || '%', negative: parseInt(arguments[convCount]) < 0 ? true : false, argument: String(arguments[convCount]) }; } strings[strings.length] = string.substring(matchPosEnd); if (matches.length == 0) { return string; } if ((arguments.length - 1) < convCount) { return null; } var code = null; var match = null; var i = null; for (i=0; i

%s

作者%s

浏览次数%s

上载日期%s

播放播放", // VideoTable : "

%s

Submited by%s

View Count%s

Create Date%s

PlayPlay
", // Title -> Author -> View Count -> Create Date FillVideoTable : function(jsonObj, element){ $.each(jsonObj, function(index, obj){ obj.description = obj.description.split("\n").join("
"); tags = sprintf(Template.VideoTable, obj.url, obj.url, obj.res_id, obj.title, obj.description, obj.url, obj.embed_src, obj.title, obj.author_name, obj.rating, obj.create_date, obj.url, obj.embed_src, obj.title, obj.url); $(tags).appendTo(element); }); $("a.dialog_button").unbind().mouseover(function(){ $(this).addClass("ui-state-hover"); }).mouseout(function(){ $(this).removeClass("ui-state-hover"); }); $("img[title]").click(function(){ if ($(this).attr("embed_src") != ""){ $("#VIDEO_SRC").empty(); flash = $(unescape($(this).attr("embed_src"))); flash.appendTo($("#VIDEO_SRC")); requiredWidth = (parseInt(flash.attr("width")) + 20); $("#REGION_video").dialog({ bgiframe : true, autoOpen : true, modal : true, width : requiredWidth, title : $(this).attr("video_title"), resizable : false, buttons : { "关闭" : function(){ $(this).dialog("destroy") } } }); return false; } else { } }); $("img[title]").tooltip({ track : true, showURL : false, extraClass : "ui-corner-all ui-state-default tips", showBody : " !---! ", delay : 0 }); $.each($("a[tag=popup]"), function(index, obj){ if ($(obj).attr("url") == "") $(obj).remove(); else { $(obj).prev().hide(); $(obj).click(function(){ $("#VIDEO_SRC").empty(); flash = $(unescape($(obj).attr("url"))); flash.appendTo($("#VIDEO_SRC")); requiredWidth = (parseInt(flash.attr("width")) + 20); $("#REGION_video").dialog({ bgiframe : true, autoOpen : true, modal : true, width : requiredWidth, title : $(obj).attr("video_title"), resizable : false, buttons : { "关闭" : function(){ $(this).dialog("destroy") } } }); return false; }); } }); } } var Helper = { fixScroll : function(){ // $("html").css("overflow", "hidden"); // $(".ui-widget-overlay").height("100%").width($(window).outerWidth()); }, unfixScroll : function(){ // $("html").css("overflow", "auto"); } } var Resource = { // Defintions RM_ADD_SUCCEED : 1, // Items added RM_ADD_FLOOD_GUARD : 2, // Items not added due to flooding control RM_ADD_DB_ERROR : 3, // Items not added due to DB error RM_ADD_DUPLICATED : 4, // Items already exists RM_SORT_BY_TIME : 1, // Items sort by time RM_SORT_BY_RATING : 2, // Items sort by rating RM_SORT_BY_RANDOM : 3, // Items sort by random RM_SORT_ASCENDING : 0, // Items sort in ascending order RM_SORT_DECENDING : 1, // Items sort in decending order // Private members ResourceListing : null, // Methods Create : function(result){ }, GetResourceListing : function(sort_by, sort_order, callback){ if (Resource.ResourceListing) Resource.ResourceListing = null; $.ajax({ type : "GET", url : "control/Controller.ResourceManager.php", dataType : "json", data : { "function" : "GetResourceListing", "sortby" : sort_by, "sortorder" : sort_order }, success : function(jsonObj){ Resource.ResourceListing = jsonObj; if (callback) callback(); } }); }, //Events OnCreateSucceed : function(result){ div = $("
"); $("

你的申请已获受理.

请耐心等候审批结果. 审批完成后, 你会收到我们发出之电子邮件通知.

").appendTo(div); div.appendTo($("body")).dialog({ modal : true, title : "申请已获受理", resizable : false, draggable : false, bgiframe : true, buttons : { "确定" : function(){ $(this).dialog("close").remove(); } } }); }, OnCreateFailed : function(result){ div = $("
"); $("

发生一个错误, 代号 : "+ result +"

请重试. 如问题无法解决, 请与 Union Creations 联络.

").appendTo(div); div.appendTo($("body")).dialog({ modal : true, title : "申请失败", resizable : false, draggable : false, bgiframe : true, buttons : { "确定" : function(){ $(this).dialog("close").remove(); } } }); } } $(".ul_button li").css({ backgroundPosition: '0px 0px' }).hover(function(){ $(this).stop().css("backgroundPosition", "0px -51px") .animate({ backgroundPosition : "15px -51px" }, { duration : 200 }); }, function(){ $(this).stop().animate({ backgroundPosition : "0px 0px" }, { duration : 200 }); }); $("[tag=LINK_create]").click(function(){ $("#REGION_create").dialog("open"); return false; }); $("[tag=LINK_terms]").click(function(){ $("#REGION_terms").dialog("open"); return false; }); $("#REGION_create").dialog({ bgiframe : true, autoOpen: false, width: 400, modal: true, resizable : false, // events open : function(event, ui){ $("input[name=url]", $(this)).val($("input[name=url]", $(this)).attr("default_value")).select().focus().click(function(){ $(this).val("").unbind("click").unbind("keydown"); }).keydown(function(){ $(this).unbind("click").unbind("keydown"); }); $("#REGION_create ~ div > button:last-child").css({ float : "left", marginLeft : "7px" }); }, // end of events buttons : { '取消' : function(){ $(this).dialog("close"); }, '提交' : function(){ // $(this).dialog("close"); $("#FORM_create").submit(); }, '相关条款' : function(){ $("#REGION_terms").dialog("open"); } } }); $("#REGION_terms").dialog({ bgiframe : true, autoOpen : false, width: 500, modal: true, resizable : false, buttons : { "关闭" : function(){ $(this).dialog("close") } } }); $("#tabs").tabs({ cache : true, spinner : "载入中...", load : function(event, ui){ } }); $("a.dialog_button").unbind().mouseover(function(){ $(this).addClass("ui-state-hover"); }).mouseout(function(){ $(this).removeClass("ui-state-hover"); }); Resource.GetResourceListing(Resource.RM_SORT_BY_TIME, Resource.RM_SORT_DECENDING, function(){ Template.FillVideoTable(Resource.ResourceListing, $("#tabs-1")); }); Resource.GetResourceListing(Resource.RM_SORT_BY_RATING, Resource.RM_SORT_DECENDING, function(){ Template.FillVideoTable(Resource.ResourceListing, $("#tabs-2")); }); Resource.GetResourceListing(Resource.RM_SORT_BY_RANDOM, Resource.RM_SORT_DECENDING, function(){ Template.FillVideoTable(Resource.ResourceListing, $("#tabs-3")); }); });