Prv8 Shell
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4
System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64
User : jackjohn ( 502)
PHP Version : 5.3.17
Disable Function : NONE
Directory :  /home/jackjohn/public_html/shopsite-images/en-EU/javascript/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/jackjohn/public_html/shopsite-images/en-EU/javascript/themepicker.js
"use_strict";
var state = {
	selected_layout: "",
	selected_theme: "",
	selected_screen: "page_screen",
	selected_file: "",
	preloaded: false,
	initiated: false,
	ADC_button_url: "",
	VC_button_url: "",
	ADC_button_type: "",
	VC_button_type: ""
};collapsible_save_state=false;collapsible_cookie=false;

function preload_theme_images(layout, prev, obj) {
	if (!state.preloaded && (layout == state.selected_layout)) {
		if (prev.complete) {
			var url = $(obj).find('.theme_product_url').val(), i = new Image(), next;
			get_image_src(url, i, 0);

			url = $(obj).find('.theme_cart_url').val(); i = new Image();
			get_image_src(url, i, 0);

			if ((next = $(obj).next()).length) {
				preload_theme_images(layout, i,next);
			} else
				state.preloaded = true;
		}
		else
			setTimeout(function(){preload_theme_images(layout, prev,obj)}, 50);
	}
}

$(function() {
	$('.theme_thumb_src').each(function() {
		let src = $(this).val(),img = new Image(),placeholder = $(this).prev();
		img.src = src;
		$(img).on('load',function() {placeholder.replaceWith(img);});
	});

	$(document).on('click','.selected_theme_list > li', function() {
		state.initiated = true;
		$('#selected_theme').removeAttr('id');
		state.selected_theme = $(this).find('.theme_name_input').val();
		$(this).attr('id','selected_theme');

		$('.' + state.selected_screen).click();
	});

	$(document).on('click','.cart_screen, .page_screen', function() {
		var url = "";
		var jpg;

		$('#selected_screen').removeAttr('id');
		state.selected_screen = $(this).attr('class');

		var which = '.theme_product_url';
		if (state.selected_screen == 'cart_screen')
			which = '.theme_cart_url';

		url = $('#selected_theme').find(which).val();

		$(this).attr('id','selected_screen');

		var image = new Image();
		get_image_src(url, image, 1);
		preload_theme_images(state.selected_layout, image, $('.selected_theme_list').find('li:first'));
	});

	$('.layout_list > li').on('click',function() {
		state.preloaded = false;
		$('.selected_layout').removeClass('selected_layout');
		state.selected_layout = $(this).find('.layout_name_input').val();
		state.selected_file = $(this).find('.layout_name_input').attr('id');
		$(this).addClass('selected_layout');
		var layout = this;

		var minWidth = 1000;

		html = $('#modal_template').text();
		html = html.replace(/SELECTED_LAYOUT/g, state.selected_layout);
		html = $(html);
		if ($(this).find('.theme_list').children('li').length == 1)
			$('#theme_list_wrapper', html).hide();

		if (typeof pathway !== 'undefined' && pathway == 'orderanywhere') {
			state.selected_screen = 'cart_screen';
			$('#screen_list_wrapper',html).hide();
		}
		if ($(this).prevAll('li:not(.theme_header)').length)
			$('#previous_theme', html).remove();
		if ($(this).nextAll('li:not(.theme_header)').length)
			$('#next_theme', html).remove();

		$.modal("", {
			closeHTML: "",
			maxHeight: "98%",
			overlayClose:false,
			autoPosition: true,
			autoResize: true,
			containerCss: {"min-width": "70%"}
		});

		$('#simplemodal-data').html(html);
		$('#theme_list_wrapper').find('.selected_theme_list').replaceWith($(this).find('.theme_list').clone(false).removeClass('theme_list').addClass('selected_theme_list'));

		$('#theme_preview_img_wrapper').hover(function(){$('#theme_nav').fadeIn();},function(){$('#theme_nav').fadeOut();});
		if((x=$('.selected_theme_list > li > .theme_name_input[value="'+$('#themeName').val()+'"]:first')).length > 0)
			x.parent().click();
		else
			$('.selected_theme_list > li:first').click();
	});
});

$(document).on('click','#previous_theme',function(){$('.selected_layout').prevAll('li:not(.theme_header)').first().click()});
$(document).on('click','#next_theme',function(){$('.selected_layout').nextAll('li:not(.theme_header)').first().click()});

$(document).on('click','#use_this_theme', function () {
	$.modal.close();
	$('#themeFile').val(state.selected_file);
	$('#themeName').val(state.selected_theme);
	if ($('#button_next_alone').length > 0)
		$('#button_next_alone').click();
	else
		$('#button_save_changes').click();
});

$(document).on('click','#close_theme_modal, #close_theme_modal_x',function(){$.modal.close()});

function get_image_src(url,i, mode) {
	if (url.search(/(\.jpg|\.gif|\.png)/i) != -1) {
		if (mode == 1) {
			$('#theme_preview_img').attr('src',url);
		} else
			$('#theme_list_wrapper').append('<img class="theme_preload_img" alt="">').attr('src',url);
		i.src = url;
	} else {
		jpg = url.replace(/\.html?/i,".jpg");
		i.src = jpg;
		if (mode == 1) {
			var image = $("#theme_preview_img").attr('src',jpg);
			$(image).error(function() { get_image_src_ajax(url,i, mode, image);});
		} else {
			$('#theme_list_wrapper').append($('<img class="theme_preload_img" alt="">').attr('src',jpg));
			var image = $('.theme_preload_img:last');
			image.error(function(){get_image_src_ajax(url,i, mode, image)});
		}
	}
}

function get_image_src_ajax(url,i, mode, image) {
	ss_jQuery.ajax({
		url:'themes.cgi?ajax=get_image_src&url=' + escape(url),
		success: function(data) {
			if (data.length > 5) {
				if ((mode == 1) && ($('#theme_preview_img').attr('src') == $(image).attr('src'))) {
					$('input[value="' + url + '"]').val(data);
					$('#theme_preview_img').attr('src',data);
					i.src=data;
				} else if ((mode == 0)) {
					$('input[value="' + url +'"]').val(data);
					$(image).attr('src',data);
					i.src=data;
				}
			}
		},
		async:true
	});
}

haha - 2025