File: D:/HostingSpaces/KLeeuwen/samenbouwen.in/wwwroot/wp-content/themes/dlight/settings/settings.js
var deployed = 'no';
var currentLogo = 'darkone_div_logo_normal';
var changeColor = function(color, ratio, darker) {
color = color.replace(/^\s*|\s*$/, '');
color = color.replace(
/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i,
'#$1$1$2$2$3$3'
);
var difference = Math.round(ratio * 256) * (darker ? -1 : 1),
// Determine if input is RGB(A)
rgb = color.match(new RegExp('^rgba?\\(\\s*' +
'(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])' +
'\\s*,\\s*' +
'(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])' +
'\\s*,\\s*' +
'(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])' +
'(?:\\s*,\\s*' +
'(0|1|0?\\.\\d+))?' +
'\\s*\\)$'
, 'i')),
alpha = !!rgb && rgb[4] != null ? rgb[4] : null,
decimal = !!rgb? [rgb[1], rgb[2], rgb[3]] : color.replace(
/^#?([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i,
function() {
return parseInt(arguments[1], 16) + ',' +
parseInt(arguments[2], 16) + ',' +
parseInt(arguments[3], 16);
}
).split(/,/),
returnValue;
return !!rgb ?
'rgb' + (alpha !== null ? 'a' : '') + '(' +
Math[darker ? 'max' : 'min'](
parseInt(decimal[0], 10) + difference, darker ? 0 : 255
) + ', ' +
Math[darker ? 'max' : 'min'](
parseInt(decimal[1], 10) + difference, darker ? 0 : 255
) + ', ' +
Math[darker ? 'max' : 'min'](
parseInt(decimal[2], 10) + difference, darker ? 0 : 255
) +
(alpha !== null ? ', ' + alpha : '') +
')' :
[
'#',
pad(Math[darker ? 'max' : 'min'](
parseInt(decimal[0], 10) + difference, darker ? 0 : 255
).toString(16), 2),
pad(Math[darker ? 'max' : 'min'](
parseInt(decimal[1], 10) + difference, darker ? 0 : 255
).toString(16), 2),
pad(Math[darker ? 'max' : 'min'](
parseInt(decimal[2], 10) + difference, darker ? 0 : 255
).toString(16), 2)
].join('');
};
var lighterColor = function(color, ratio) {
return changeColor(color, ratio, false);
};
var darkerColor = function(color, ratio) {
return changeColor(color, ratio, true);
};
var pad = function(num, totalChars) {
var pad = '0';
num = num + '';
while (num.length < totalChars) {
num = pad + num;
}
return num;
};
function rgb2hex(rgb) {
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
function hex(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
}
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
(function($){
"use strict";
$(document).ready(function(){
$('#darkone_settings').find('#width-1200').addClass('activated');
$('#darkone_settings').find('#settings_wide').addClass('activated');
$('#darkone_settings').find('.color_pick.darkone_yellow').addClass('activated');
$(document).on('click', '#show_hide_settings', function(e) {
e.preventDefault();
if ( deployed == "no" ){
$('#darkone_settings').animate({'left':0}, 200);
deployed = "yes";
}
else {
$('#darkone_settings').animate({'left':-186}, 200);
deployed = "no";
}
});
var current_header = 'layout-'+$('#settings-header-layout').children(":selected").text();
$(document).on('change', '#settings-header-layout', function(e) {
var current_class = $('.header_wrapper').attr('class');
var selected_header = $(this).children(":selected").text();
var class_new = current_class.replace(current_header, 'layout-'+selected_header);
$('.header_wrapper').attr('class', class_new);
current_header = 'layout-'+selected_header;
return false;
});
$(document).on('click', '#settings_boxed', function() {
$(this).parent().children().removeClass('activated');
$(this).addClass('activated');
var current_width = $('#darkone_settings').find('.settings_button_width.activated').text();
$('#darkone_wrapper, .top-separator').css('max-width', current_width+'px');
if ( $('body').hasClass('darkone_wide') ) {
$('body').removeClass('darkone_wide').addClass('darkone_boxed');
}
});
$(document).on('click', '#settings_wide', function() {
$(this).parent().children().removeClass('activated');
$(this).addClass('activated');
$('#darkone_wrapper, .top-separator').css('max-width', '100%');
if ( $('body').hasClass('darkone_boxed') ) {
$('body').removeClass('darkone_boxed').addClass('darkone_wide');
}
});
$(document).on('click', '.settings_button_width', function() {
$(this).parent().children().removeClass('activated');
$(this).addClass('activated');
var width = $(this).text();
$('.darkone_container, .darkone_boxed .top-separator, body.darkone_boxed #darkone_wrapper, .social_header, .header_wrapper nav li.menu-item.has_sidebar ul.navmenu_fullwidth li.sidebar_holder, .darkone_maxwidth, .header_wrapper .menu_wrapper, .darkone_top').css('max-width', width+'px');
});
$(document).on('change', '#settings-headings-font', function() {
var newFont = $(this).find("option:selected").text();
var style = 'body,li.sidebar_holder{font-family:"PT Sans",serif; font-style:normal}#darkone_div_header_menu,#form-wrap >p:first-child,#sendpress_signup #thanks,.bbp-footer,.bbp-forum-title,.bbp-header,.bbp-pagination-count,.bbp-topic-permalink,.darkone_header_font,.footer_header .footer_counter,.menu-trigger-icon,.news_feed_tabs .tabsnav a,.shop_table.cart thead,.widget>ul>li,.woocommerce .summary .price,.woocommerce-tabs ul.tabs>li>a,.yop-poll-question,aside .product_list_widget a,aside.widget_display_stats,h1,h2,h3,h4,h5,h6,span.product_hover_text, .frb_scrl_count_digit_wrap, .frb_percentage_chart, p.logged-in-as, p.comment-notes {font-family:"'+newFont+'",serif !important}';
$('head #darkone_font_styles').remove();
$('head').append('<style id="darkone_font_styles" type="text/css">'+style+'</style>');
});
$(document).on('change', '#settings-background', function() {
var current = $(this).find("option:selected").text();
var newFile = 'http://www.shindiristudio.com/division/bg/'+current;
$('body').css({'background-image' : 'url('+newFile+')', 'background-position' : 'center center', 'background-repeat' : 'repeat'});
});
$(document).on('change', '#settings-logo', function() {
var current = $(this).find("option:selected").val();
$('.header_wrapper').removeClass(currentLogo).addClass(current);
currentLogo = current;
});
$(document).on('click', '.color_pick', function() {
$(this).parent().children().removeClass('activated');
$(this).addClass('activated');
var color_name = $(this).attr('data-color');
var color = rgb2hex($(this).css('background-color'));
var current_color = rgb2hex($('#darkone_div_current_color').css('background-color'));
var rgb_current_color = $('#darkone_div_current_color').css('background-color');
var only_rgb = color.substring(4);
only_rgb = only_rgb.replace(')','');
$(document).find('style').each(function(){
var re = new RegExp(current_color, 'g');
$(this).html($(this).html().replace(re, color));
});
$('#fbuilder_content_wrapper *').filter(function() {
return $(this).css('background-color') == rgb_current_color;
}
).css('background-color', color);
$('#fbuilder_content_wrapper *').filter(function() {
return $(this).attr('data-backcolor') == current_color;
}
).attr('data-backcolor', color);
$('#fbuilder_content_wrapper *').filter(function() {
return $(this).attr('data-hoverbackcolor');
}
).attr('data-hoverbackcolor', lighterColor(color,0.2));
$('.frb_separator').css('border-color', color);
var color_header = color_name;
if ( $('body').hasClass('darkone_light') ) {
color_header = 'white_'+color_name;
}
$('img.darkone_div_mainlogoimg').attr('src', darkoneService.siteurl+'/settings/images/logo_'+color_header+'.png');
$('img.darkone_div_sticky_logoimg').attr('src', darkoneService.siteurl+'/settings/images/logo_'+color_header+'.png');
$('img.darkone_div_footerlogo').attr('src', darkoneService.siteurl+'/settings/images/logo_'+color_name+'_white.png');
$('.tp-caption.Darkone-Price-Small-er').css('background-color', color);
$('#darkone_div_current_color').css('background-color', color);
});
});
})(jQuery);