var m_html = '



'; var m_browser=0; var m_browser2=0; var m_browser3=0; var selected_tab = 0; var sbc = 0; var chat_content; /** Check Right Menu Settings **/ var right_menu = getCookie("right_menu"); if (right_menu != 1) { setCookie("right_menu", 0, 365); right_menu = 0; } $(document).on("click", ".category-toggle", function() { $("#category-list").hide(); $(".category-display").show(); }); $(document).on("click", ".category-display", function() { $("#category-list").show(); $(".category-display").hide(); }); $(document).on("click", ".toggle_menu", function() { if (right_menu == 0) { $("#right_box_page").removeClass("hideme"); $("#right_box_page").addClass("col-sm-3 col-md-2"); $("#main_box_page").addClass("col-sm-9 col-md-10"); right_menu = 1; setCookie("right_menu", 1, 365); } else { $("#right_box_page").removeClass("col-sm-3 col-md-2"); $("#main_box_page").removeClass("col-sm-9 col-md-10"); $("#right_box_page").addClass("hideme"); right_menu = 0; setCookie("right_menu", 0, 365); } size(); }); $(document).on("click", ".manager_ArtworkName", function() { var id = $(this).data("artwork_id"); $("#manager_ArtworkEditor").load("/manager/?ajax=true&action=ShowSkin&id=" + id); }); $(document).on("click", ".btnSubmitChat", function() { var msg = $(".chatInputBox").attr("value"); $(".chatInputBox").attr("value", ""); $.post("/chat_post", {'message' : msg}, function(data) { $("#sideBarChat").html(data); }); }); $(document).on("click", ".addFavourites", function() { var id = $(this).data("artwork_id"); console.log(id); $.getJSON("/ajax/add_artwork_favourites/" + id, function(data) { }); }); $(document).on("change", "#root_categories", function() { var id = $("#root_categories option:selected").val(); $(".category-types").hide(); $(".type" + id).show(); }); /* $(document).on('click', "#submitRegisterForm", function(e) { e.preventDefault(); $("").attr("type", "hidden") .attr("name", "register") .attr("value", "user") .appendTo("#submitRegisterForm"); document.getElementById("signupForm").submit(); }); */ $(document).on("click", "#btn_UploadArtwork", function() { $("#btn_UploadArtwork").html('Uploading.... '); $("#btn_UploadArtwork").attr("class", "btn btn-warning"); $("#btn_UploadArtwork").hide(1000); $("#uploadInfo").html('
Please wait Uploading in progress ...
'); $("#uploadArtworkForm").submit(); }); $(document).on("change", "#section_filter", function() { var id = $("#section_filter option:selected").val(); //console.log(id); $("#mySectionList").html('


'); $("#mySectionList").load("/upload/?ajax=true&action=updateCats&id=" + id); }); $(document).on("click", ".insert_smiley", function() { var code = $(this).data("code"); var dst = $(this).data("target_name"); var tmp = $("textarea[name=" + dst + "]").val(); var res = tmp + ' ' + code; //console.log(code,dst,tmp," =====> " + res); $("textarea[name=" + dst + "]").val(res); }); /***** Add User To Following List *****/ $(document).on("click", ".follow_user", function() { var user_id = $(this).data("user_id"); $.getJSON("/ajax/follow_user/" + user_id, function(data) { if (data.status['error'] > 0) { alert(data.status['description']); } else { $(".ab-" + user_id).html(' Following'); } }); }); $(document).on("change", ".quickThumbShow", function(evt) { var preview = $(this).data("preview_id"); var files = evt.target.files; var f = files[0]; var reader = new FileReader(); reader.onload = (function(theFile) { return function(e) { fname = (theFile.name); if (!fname.match(/\.(gif|jpg|jpeg|tiff|png)$/i)) { $("#" + preview).html("Selected file: " + theFile.name + ""); $("#preview_box").show(); console.log("no image - ", preview, theFile.name); } else { document.getElementById(preview).innerHTML = [''].join(''); } }; })(f); reader.readAsDataURL(f); }); var numCols = 4; function size() { NProgress.start(); var $container_photo = $('.container_photo'); var w = $container_photo.width(); var c = Math.floor(w / 250); var wc = parseInt($container_photo.width() / c); var r = parseInt(w / c) - 30; //console.log(w, "Cols:" + c, "width: " + r + "px"); $(".photo_frame").css("width", r + "px") $container_photo.isotope({ masonry: { columnWidth: c } }); $container_photo.imagesLoaded( function() { $container_photo.isotope({ itemSelector : '.photo_frame', layoutMode : 'masonry' }); }); $container_photo.isotope( 'on', 'layoutComplete', function() { var hgt = $("#artwork_browser").css("height"); if (hgt < 500) { hgt = 500; } $("#artwork_subcategories").css("height", hgt); }); NProgress.done(); } // End size() size(); $(document).ready(function() { $("#artwork_subcategories").stick_in_parent(); NProgress.start(); $(".scrollContent").mCustomScrollbar(); $(".artwork-zoom").magnificPopup({ type: 'image', removalDelay: 3800, mainClass: 'mfp-fade' }); $(window).smartresize(size); //size(); $(".selectme").select2(); $(".summernote").summernote(); $(".summernote_lite").summernote({ toolbar: [ ['style', ['bold', 'italic', 'underline', 'clear']], ['font', ['strikethrough']], ['fontsize', ['fontsize']], ['color', ['color']], ] }); var $box_gallery = $('.box_gallery'); $box_gallery.imagesLoaded( function(){ $box_gallery.isotope({ itemSelector : '.img-frame', layoutMode : 'masonry' }); }); var $container_comments = $(".masonry"); $container_comments.imagesLoaded( function(){ $container_comments.isotope({ itemSelector : '.masonry_item', layoutMode : 'masonry' }); }); var $container_news = $('.container_news'); $container_news.imagesLoaded( function(){ $container_news.isotope({ itemSelector : '.news_frame', layoutMode : 'masonry' }); }); if ($("a[rel^='prettyPhoto']").length > 0) { $("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'}); } $("#sideBarSep").click(function() { if(sbc == 0) { $("#sideBarChat").animate({ height: '700px' }, 1000, function(){ // Complete sbc = 1; $("#sideBarSep").addClass("chat_opened"); }); } else { $("#sideBarChat").animate({ height: '550px' }, 1000, function(){ // Complete sbc = 0; $("#sideBarSep").removeClass("chat_opened"); }); } }); if ($(".followingButton").length > 0) { $(".followingButton").click(function() { $("#showNoticeBox").load("/include/hideNoticeBox.php?show=following"); }); } if ($(".streamPost").length > 0) { var remme = false; $(".stream_Remove").click(function() { var wid = $(this).attr("rel"); if (confirm("Remove this notice?")) { $("#"+wid).hide(); $("#showNoticeBox").load("/include/hideNoticeBox.php?id="+wid); remme = true; } }); $(".streamPost").click(function() { $("BODY").scrollTop(0); var wid = $(this).attr("rel"); var id = $(this).attr("id"); if (remme == false) { $(".streamContent").removeClass("StreamSelected"); $("#"+id+" > .streamContent").addClass("StreamSelected"); $("#showNoticeBox").load("/include/loadNoticeBox.php?id="+wid); } remme = false; }); } if ($("#js-news").length >0) { $('#js-news').ticker(); } if ($("#imageTicker").length >0) { $("#imageTicker").slideDown().newsticker(); } if ($(".changeCoverArt").length > 0) { $(".changeCoverArt").click(function() { $("#mywindow").center(); $("#mywindow").show(); }); } $(".openwin").fancybox({}); $('#ajaxForm').submit(function() { alert('Handler for .submit() called.'); return false; }); $(".btn_category").fancybox({ 'href' : '/ajax/show-categories', 'width' : 600, 'height' : 200, 'transitionIn' : 'fade' }); $(".navbar-fixed-top").autoHidingNavbar({ }); $(".category_btn").fancybox({ 'href' : '/ajax/show_categories', 'width' : 600, 'height' : 200, 'transitionIn' : 'fade' }); $(".category_btn2").fancybox({ 'href' : '/ajax/show_categories', 'width' : 600, 'height' : 200, 'transitionIn' : 'fade' }); if ($("#chat_box").length > 0) { InitChat(); } $("#loginMenu span").click(function() { $("#subLoginMenu").toggle(); }); if ($("#browseMenu").length > 0){ $("#browseMenu").click(function(){ //showCategories(); $("#browserMenuList").toggle(); }); } if ($("#butCategories").length > 0){ $("#butCategories").click(function(){ var catID = $("#butCategories").attr("rootid"); showCategories(catID); }); } $("#messageLink").click(function(){ $("#streamType").val("message"); $("#update_button").html("Publish"); $("#streamMessage").val(""); }); $("#pageLink").click(function(){ $("#streamType").val("link"); $("#update_button").html("Attach link"); $("#streamMessage").val("http://"); }); $("#publishButton").click(function(){ //event.preventDefault(); var type = $("#streamType").val(); var data = encodeURI($("#streamMessage").val()); //alert("/social/getStreamData.php?type="+type+"&data="+data); $("#streamWork").load("/social/getStreamData.php?type="+type+"&data="+data); $("#streamMessage").val(""); }); $("#shareBox textarea").elastic(); /*if($("#total_msgs").length > 0) { showDownloadCounter(); }*/ $('textarea.tinymce').tinymce({ // Location of TinyMCE script script_url : '/js/tiny_mce/tiny_mce.js', // General options theme : "advanced", plugins : "smileys,sdcode,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,youtube", // Theme options theme_advanced_buttons1 : "smileys,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,removeformat,sub,sup,emotions,image,media,youtube", theme_advanced_buttons2 : "pastetext,pasteword,|,bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,cleanup,forecolor,backcolor", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "", theme_advanced_resizing : true, valid_elements: "@[style],img[src|class|alt],a[href|target=_blank],-span,-strong,-em,-strike,u,#p,br,-ol,-ul,-li,-sub,-sup,-pre,-address,-h1,-h2,-h3,-h4,-h5,-h6", }); NProgress.done(); }); // Document ready function showSubCat(id) { $(".browseCategoryBox").load("/ajax/show-categories/" + id) } function put_smiley(smiley,outp) { document.forms['newMsg'].comment.value += ' ' + smiley + ' '; document.forms['newMsg'].comment.focus(); } function put_smiley_art(smiley,outp) { document.forms['newMsg'].commentText.value += ' ' + smiley + ' '; document.forms['newMsg'].commentText.focus(); } function put_smiley_chat(smiley) { var txt = $("#chat_txt").val() + ' ' + smiley + ' '; $("#chat_txt").val(txt); $("#chat_txt").focus(); } function put_smiley2(smiley,outp) { document.forms['newMsg'].Review.value += ' ' + smiley + ' '; document.forms['newMsg'].Review.focus(); } function expw(listID) { if (document.getElementById(listID).style.display=="none") { document.getElementById(listID).style.display=""; document.getElementById(listID).style.visibility="visible"; } else { document.getElementById(listID).style.display="none"; document.getElementById(listID).style.visibility="hidden"; } } function contw(listID) { if (listID.style.display=="show") {listID.style.display="";} else {listID.style.display="none";} window.event.cancelBubble=true; } function Confirm(link,text) { if(confirm(text)) window.location=link } function Draw() { $("#dl_box").load("/cron/show_dls.php"); } function DrawOnline() { $("#chat_box").html(m_html); $("#chat_box").load("/cron/show_online.php"); } function ShowGroups(id) { $("#skin_groups").load("/display_groups.php?id="+id); } function InitChat() { NProgress.start(); $.get("/show-chat", function(data) { //alert(data); if (compare(chat_content, data) == false) { chat_content = data; $("#chat_box").html(data); } }); setTimeout("InitChat()", 4000); NProgress.done(); } function compare(s1, s2) { return s1===s2; } function updateSubgroups() { var id = document.browser.groups.options[document.browser.groups.selectedIndex].value; $("#skinGroups").load("/include/get_groups.php?id="+id); } /***********************************************/ /** UPLOADS MANAGER **/ /***********************************************/ function ShowSkin(id) { $("#msgShow").html(m_html); $("#msgShow").load("/manul.php?ajax=true&action=ShowSkin&id="+id); } function EditArtwork(id) { $("#artworkEditor").html(m_html); console.log("/manul.php?ajax=true&action=ShowSkin&id="+id); $("#artworkEditor").load("/manul.php?ajax=true&action=ShowSkin&id="+id); } function clearField(field) { m_html = ''; document.getElementById(field).innerHTML = m_html; } /***********************************************/ /** PRIVATE MESSAGES **/ /***********************************************/ $(document).on("click", ".message_reply", function() { var id = $(this).data("message_id"); var message = encodeURIComponent($(".note-editable").html()); $("#message_reply_info").load("/messages/?ajax=true&action=ReplyMsg&message=" + message + "&id=" + id); $(".note-editable").html(""); console.log(id, message); }); $(document).on("click", ".message_delete", function() { var id = $(this).data("message_id"); console.log(id); $("#message_show").html(''); $("#message_list").load("/messages/?ajax=true&action=DelMsg&id=" + id); }); $(document).on("click", ".message_show", function() { var id = $(this).data("message_id"); $("#message_show").html(m_html); $.get("/messages/?ajax=true&action=ShowMsg&id=" + id, function(data) { $("#message_show").html(data); }); }); $(document).on("click", ".write_message", function() { $("#message_show").load("/messages/?ajax=true&action=msgList&box=new"); }); function updatePrivMsgBox() { $.get("include/updatePrivMsgBox.php"); $("#msgBox").hide(); $("#msgBoxTxt").hide(); $("#msgBoxX").hide(); } function ShowPrivateMessage(id) { $("#msgShow").html(m_html); $("#msgShow").load("/privmsg.php?ajax=true&action=ShowMsg&id="+id); } function ShowPrivateMessageList(box, id) { if (box !== 'new') { $("#msgList").html(m_html); $("#msgShow").html(''); } if (box == 'new') { //alert ("/privmsg.php?ajax=true&action=msgList&box="+box+"&id=" + id); $("#msgShow").load("/privmsg.php?ajax=true&action=msgList&box="+box+"&id=" + id); } else { $("#msgList").load("/privmsg.php?ajax=true&action=msgList&box="+box+"&id=" + id); } } function SaveMessage(id) { $("#msgList").html(m_html); $("#msgShow").html(''); $("#msgList").load("/privmsg.php?ajax=true&action=SaveMsg&id=" + id); } function DeleteMessage(id,box) { $("#msgList").html(m_html); $("#msgShow").html(''); $("#msgList").load("/privmsg.php?ajax=true&action=DelMsg&box="+box+"&id="+id); } function ShowProfile(id,uname){ $("#profileContent").html(m_html); $("#profileContent").load("/profile.php?show="+id+'&uname='+uname); } function showDailySkins(datums,x){ $("#myContent").html(m_html); if (selected_tab>0) { document.getElementById('tab-'+selected_tab).style.fontWeight = 'normal'; document.getElementById('tab-'+selected_tab).style.backgroundColor = '#eee'; } document.getElementById('tab-'+x).style.fontWeight = 'bold'; document.getElementById('tab-'+x).style.backgroundColor = '#ccc'; selected_tab = x; $("#myContent").load("/daily-uploads/?ajax=true&datum=" + datums); } function showCategories() { updateSkinBrowser("displayCategoriesX",0,0); $("#mainDisplayX").slideToggle(); } function showCategories2(namek) { if(namek == 0) { visina = 430; levo = 160; } else if(namek == 1) { visina = 140; levo = 52; } else { visina = findPosY(namek) + 23; levo = findPosY(namek) + 30; } document.getElementById('mainDisplay2').style.top = visina+"px"; document.getElementById('mainDisplay2').style.left = levo+"px"; //alert(visina); m_browser2 = m_browser2+1; //alert(); if(m_browser2==2) { //new Effect.Puff(document.getElementById("displayCategories")); document.getElementById("mainDisplay2").style.visibility = "hidden"; m_browser2 = 0; } else { //new Effect.Appear(document.getElementById("displayCategories")); document.getElementById("mainDisplay2").style.visibility = "visible"; updateSkinBrowser("displayCategories2",0,0); } } function updateSkinBrowser(divID,id,subid) { //alert(id+" - "+divID); $("#"+divID).html(m_html); $("#"+divID).load("/include/skinBrowser.php?id="+id+"&subid="+subid+"&divID="+divID); } function findPosX(obj) { var curleft = 0; if(obj.offsetParent) while(1) { curleft += obj.offsetLeft; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.y) curtop += obj.y; return curtop; } function ShowBrowserWin() { m_browser = m_browser+1; if(m_browser==2) { //new Effect.Puff(document.getElementById("showBrowser")); document.getElementById("showBrowser").style.visibility = "hidden"; m_browser = 0; } else { //new Effect.Appear(document.getElementById("showBrowser")); document.getElementById("showBrowser").style.visibility = "visible"; updateSkinBrowser("showBrowser",0); } } function removeNotice(id,type) { $.get("/include/removeNotice.php?id="+id+"&type="+type); $("#wu-"+id).hide(1000); } (function($){ $.fn.extend({ center: function () { return this.each(function() { var top = ($(window).height() - $(this).outerHeight()) / 2; var left = ($(window).width() - $(this).outerWidth()) / 2; $(this).css({position:'absolute', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'}); }); } }); })(jQuery); (function($,sr){ // debouncing function from John Hann // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ var debounce = function (func, threshold, execAsap) { var timeout; return function debounced () { var obj = this, args = arguments; function delayed () { if (!execAsap) func.apply(obj, args); timeout = null; }; if (timeout) clearTimeout(timeout); else if (execAsap) func.apply(obj, args); timeout = setTimeout(delayed, threshold || 100); }; } // smartresize jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); }; })(jQuery,'smartresize'); function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires; } function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i