This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwp_theme_settings.min.js
10 lines (10 loc) · 3.83 KB
/
wp_theme_settings.min.js
1
2
3
4
5
6
7
8
9
10
/**
* Class Name: wp_theme_settings
* GitHub URI: http://www.github.com/mattiasghodsian/wp_theme_settings
* Description: A custom WordPress class for creating theme settings page (Design looks identical to WP About page)
* Author: Mattias Ghodsian
* Author URI: http://www.nexxoz.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
jQuery(document).ready(function(){if(jQuery('.nav-rtab-wrapper a[href*="#"]:not([href="#"])').click(function(){if(jQuery(".nav-rtab-wrapper > a").removeClass("nav-tab-active"),jQuery(this).addClass("nav-tab-active"),location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var a=jQuery(this.hash);a.length&&(jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(a).css("display","block"),jQuery(a.selector+" > .wpts-nav-section-holder").css("display","none"),jQuery(a.selector+"_parent").css("display","block"),jQuery(".nav-rtab-form").attr("action","options.php"+a.selector),jQuery("html, body").animate({scrollTop:0},1))}}),jQuery(".wpts-nav-sections > li > a").click(function(){var a=jQuery(this).attr("href");if(a.indexOf("&")!=-1){var b=a.split("&"),c=b[0],d=b[1].replace("section=","#");jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(c).css("display","block"),jQuery(c+" > .wpts-nav-section-holder").css("display","none"),jQuery(d).css("display","block"),jQuery(".nav-rtab-form").attr("action","options.php"+a),jQuery("html, body").animate({scrollTop:0},1)}}),window.location.hash.length){var a=window.location.hash;if(a.indexOf("&")!=-1){var b=a.split("&"),c=b[0],d=b[1].replace("section=","#");jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(c).css("display","block"),jQuery(d).css("display","block")}else jQuery(".nav-rtabs .nav-rtab-holder").css("display","none"),jQuery(a).css("display","block"),jQuery(a+"_parent").css("display","block"),jQuery(".nav-rtab-wrapper > a").removeClass("nav-tab-active"),jQuery('.nav-rtab-wrapper a[href="'+a+'"]').each(function(b){jQuery(this).addClass("nav-tab-active"),jQuery(".nav-rtab-form").attr("action","options.php"+a)})}else{var a=jQuery(".nav-rtab-wrapper > a").first().attr("href");jQuery(a).css("display","block"),jQuery(a+"_parent").css("display","block")}jQuery(".nav-tab-wrapper").length>0&&jQuery("#footer-thankyou").html('Thank you for creating with <a href="https://git.io/vi1Gr" target="_new">WPTS</a>'),jQuery(".wpts_color_field").wpColorPicker(),jQuery(".wpts_fa_field").wptsFa();var e;jQuery(".wpts-file-field").click(function(){return jQuery("html").addClass("Image"),e=jQuery(this).prev().attr("id"),tb_show("Upload File","media-upload.php?type=image&TB_iframe=true"),!1}),window.original_send_to_editor=window.send_to_editor,window.send_to_editor=function(a){e?(re=/\ssrc=(?:(?:'([^']*)')|(?:"([^"]*)")|([^\s]*))/i,res=a.match(re),src=res[1]||res[2]||res[3],jQuery("#"+e).val(src),jQuery(".wpts-file-field-preview").before("#"+e).attr("src",src),tb_remove(),jQuery("html").removeClass("Image")):window.original_send_to_editor(a)}}),function(a){a.fn.wptsFa=function(){return this.each(function(){var b=a(this),c=a(b).attr("name");a(b).hide(),a('<div class="wptsFA-container" id="'+c+'"><div class="wptsFA-icon"></div><div class="wptsFA-button">Select icon</div><div class="wptsFA-icons"></div></div>').insertBefore(b),a.get("https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml",function(b){var d=jsyaml.load(b);jQuery.each(d.icons,function(b,d){a("#"+c+" .wptsFA-icons").append('<i class="fa fa-'+d.id+'"></i>')})}),a(this).length>0&&a("#"+c+" .wptsFA-icon").html('<i class="fa '+a(this).val()+'"></i>'),a("#"+c).click(function(){a(this).toggleClass("active")}),a(document).on("click","#"+c+" .wptsFA-icons > i",function(){var d=a(this).attr("class").replace("fa","");a(b).val(d),a("#"+c+" .wptsFA-icon").html('<i class="fa '+d+'"></i>')})})}}(jQuery);