jQuery(document).ready(function(){ // for bootstrap slideshow jQuery(".carousel-control").html(""); if(jQuery('#user-login-form') .length){ if(jQuery('.i18n-en') .length){ jQuery('#user-login-form .form-item-name input') .attr('placeholder','User name'); jQuery('#user-login-form .form-item-pass input') .attr('placeholder','Password'); }else{ jQuery('#user-login-form .form-item-name input') .attr('placeholder','鐢ㄦ埛鍚?); jQuery('#user-login-form .form-item-pass input') .attr('placeholder','瀵嗙爜'); } } if(jQuery('#webform-component-span5--regarding') .length){ var job_title = jQuery('.job_id') .text(); jQuery('#webform-component-span5--regarding input') .val(job_title); } //product links attribution if(jQuery('.node-type-product') .length){ jQuery('.product_list>ul>li') .each(function(){ var href = jQuery(this) .find('a') .attr('href'); jQuery(this) .find('img') .wrap(''); }) } //homepage slideshow jQuery('.slide_container') .cycle({ fx:'scrollLeft', pager: '.slide_pager' }); // jQuery('.slide_container') .css('visibility','visible'); // homepage popup jQuery('.overlay') .click(function(){ var id = jQuery('.popup .jwplayer') .attr('id'); var player1 = jwplayer(id); if (player1 && player1.play) { player1.play(false); } }) jQuery(document).keydown(function(e){ var id = jQuery('.popup .jwplayer') .attr('id'); var player1 = jwplayer(id); if (player1 && player1.play) { player1.play(false); } if(jQuery('.node-type-home') .length){ jQuery('.overlay') .fadeOut(); jQuery('.popup') .fadeOut(); } }) jQuery('#block-search-form input[type="submit"]').parent().prepend(''); function columnHeight () { var heights = new Array; var i = 0; jQuery('.columnHeight').each(function(){ var height_col = jQuery(this).outerHeight(true); heights[i] = height_col i++; }); max = Math.max.apply(null, heights); jQuery('.columnHeight').each(function(){ var height_col = jQuery(this).outerHeight(true); if( height_col != max) { jQuery(this).css('height',max); } }); } function resize() { columnHeight(); } setTimeout(function(){ resize(); },100); jQuery(window).load(function(){ resize(); }); jQuery(window).resize(function(){ resize(); }); // product tab system with bootstrap jQuery('#product_specifications a:first').tab('show'); jQuery('#product_specifications a').click(function (e) { e.preventDefault(); jQuery(this).tab('show'); }) jQuery('.overlay,.popup_close') .click(function(){ jQuery('.overlay') .fadeOut(); jQuery('.popup') .fadeOut(); }) // add active for menu jQuery('.my_santoni_menu a').each(function(){ var href = jQuery(this).attr('href'); if(href == window.location.pathname ) { jQuery(this).addClass('active'); } }); // add btn class for bootstrap btn theming addBtn(); jQuery('.pager').parent().addClass('pager_parent'); jQuery('.pager').addClass('btn-group'); jQuery('.pager li').addClass('btn'); jQuery('#product_specifications li:first').addClass('active'); jQuery('.view-software table').addClass('table table-striped software table_support'); jQuery('#webform-ajax-wrapper-64--2').submit(function() { }); //Garnet's slider if(jQuery('.product_list_subcategory').length){ if(jQuery('.value') .length){ var titlee = jQuery('.value') .text() .toLowerCase() .replace('-',' '); jQuery('#block-menu-menu-product-menu .menu li').each(function(){ var t_text = jQuery(this) .find('a') .text() .toLowerCase(); if(t_text == titlee){ jQuery(this) .addClass('active'); jQuery(this) .find('a') .addClass('active'); } }) } var active = ''; var total = jQuery('.product_list li') .length; var w = jQuery('li.product_overview') .outerWidth() + 9; var ww = w+9; var total_w = w * total; jQuery('.product_list>ul') .css('width',total_w); jQuery('.product_list_subcategory li').each(function(){ if(jQuery(this) .find('a') .hasClass('active')){ active = jQuery(this) .text(); } }) jQuery('.product_list>ul>li') .each(function(){ tmp = jQuery(this) .attr('class'); id_tmp = tmp.split(' '); id = jQuery.trim(id_tmp[0]); if(id.toLowerCase() == active){ jQuery(this) .show(); }else{ jQuery('.product_list>ul>li') .show(); } }) //product active function if(jQuery('.field-name-field-product-name') .length){ var tmp; var name_tmp; var nm; var pro_name = jQuery('.field-name-field-product-name .field-item') .text(); jQuery('.product_list li') .each(function(){ var name = jQuery(this) .find('.title a') .text(); if(name == pro_name){ jQuery(this) .addClass('this'); tmp = jQuery(this) .attr('class'); name_tmp = tmp.split(' '); nm = jQuery.trim(name_tmp[0]); lei = jQuery.trim(name_tmp[0]); nm = nm.replace('-','_'); } }) jQuery('.product_list_subcategory li') .each(function(){ var compare = jQuery(this) .find('a') .data("subcat") .toLowerCase(); if(nm == compare){ jQuery(this) .addClass('this'); } }) jQuery('.product_list li') .hide(); jQuery('.product_list li.'+lei) .show(); } // menu click function var count = 0; var status = jQuery('.product_list_subcategory li.this a') .data("subcat") .toLowerCase(); status = jQuery.trim(status); status = status.replace('-','_'); var total = jQuery('.product_list>ul>li.'+status) .length; jQuery('.product_list_subcategory li') .click(function(){ var cate = jQuery(this) .find('a') .data("subcat") .toLowerCase(); //console.log(cate); cate = cate.replace('-','_'); jQuery('.product_list_subcategory li') .removeClass('this'); jQuery(this) .addClass('this'); jQuery('.product_list>ul>li') .each(function(){ tmp = jQuery(this) .attr('class'); //console.log(tmp); id_tmp = tmp.split(' '); id = jQuery.trim(id_tmp[0]); //console.log(id); //console.log(Drupal.t("this is a test")); if(cate == "all"){ jQuery('.product_list>ul') .css('margin-left', '0px'); jQuery('.product_list>ul>li') .show(); status = 'all'; count = 0; }else if(cate == id.toLowerCase()){ //console.log('here'); jQuery('.product_list>ul') .css('margin-left', '0px'); jQuery(this) .show(); status = cate; count = 0; }else{ jQuery('.product_list>ul') .css('margin-left', '0px'); jQuery(this) .hide(); count = 0; } }) status = status.replace('-','_'); total = jQuery('.product_list>ul>li.'+status) .length; if(total == 0){ total = jQuery('.product_list li') .length; } }) if(status == 'all'){ total = jQuery('.product_list>ul>li') .length; } //turn next or prev function jQuery('.product_list .controller .left') .click(function(){ if(count == 0||total<7){ }else{ count--; jQuery('.product_list>ul') .animate({marginLeft: -w*count},300); } }) jQuery('.product_list .controller .right') .click(function(){ if(count == total - 6||total - 6 < 0){ }else{ count++; jQuery('.product_list>ul') .animate({marginLeft:-w*count},300); } }) var attr = ''; jQuery('.product_list_subcategory li') .each(function() { if(jQuery(this) .hasClass('this')){ attr = jQuery(this) .find('a') .attr('class'); } }) jQuery('#block-menu-menu-product-menu .content li') .each(function(){ var att = jQuery(this) .children('a') .text(); att = jQuery.trim(att) .toLowerCase(); if(att == attr){ jQuery(this) .addClass('active'); jQuery(this) .children('a') .addClass('active'); } }) } if(('.slide_pager') .length){ var c = 0; var w1 = jQuery('ol.carousel-indicators li').width(); var w2 = w1+9; var num = jQuery('ol.carousel-indicators li') .length; var total_ww = w1*num; var ol_w = (w+9)*num; $('.carousel').carousel({ interval: 3000 }) jQuery('ol.carousel-indicators') .css('width',ol_w); // product sliding function jQuery('.slide_pager .controller .left') .click(function(){ if(c == 0||num<4){ }else{ c--; jQuery('ol.carousel-indicators') .animate({marginLeft: -w2*c},300); } }) jQuery('.slide_pager .controller .right') .click(function(){ if(c == num - 3||num - 3 < 0){ }else{ c++; jQuery('ol.carousel-indicators') .animate({marginLeft: -w2*c},300); } }) } var user_settings = 'closed'; jQuery('.navbar-inner .login .user_menu_settings i').click(function(){ if(user_settings == 'closed') { jQuery(this).addClass('open'); jQuery(this).parent().find('ul.menu').show(200); user_settings = 'open'; } else if(user_settings == 'open') { jQuery(this).removeClass('open'); jQuery(this).parent().find('ul.menu').hide(200); user_settings = 'closed'; } }); jQuery('.user_edit .change_password .form-item:not(.form-item-mail, .form-item-name)').wrap('
') jQuery('.page-search .search-form').clone().prependTo('.page-search .content_right'); var product_name = $('.product_name').text(); //login form bar var user_login_form = 'closed'; jQuery('.user_login_click a').click(function(){ if(user_login_form == 'closed') { jQuery(this).addClass('open'); jQuery('.user_login_form').show(200); user_login_form = 'open'; } else if(user_login_form == 'open') { jQuery(this).removeClass('open'); jQuery('.user_login_form').hide(200); user_login_form = 'closed'; } }); // jQuery('.social_button .flag-like a').text('').append(''); // jQuery('.social_button .flag-dislike a').text('').append(''); jQuery('.pager.btn-group li').click(function(){ var url = $(this).find('a').attr('href'); window.location.href = url; }); jQuery('ul li ul li.active').parent().addClass('active'); jQuery('ul li ul li.active').parent().parent().addClass('active'); jQuery('ul li ul li.active').parent().parent().parent().addClass('active'); // to display right style of the following and follower's style if(jQuery('.flag-follow').length){ jQuery('.flag-follow .flag') .each(function(){ if (jQuery(this) .hasClass('unflag-action')) { jQuery(this) .addClass('green'); }else{ jQuery(this) .addClass('gray'); } }) jQuery('.flag-follow') .delegate('.flag','click',function(){ if (jQuery(this) .hasClass('flagged')) { jQuery(this) .addClass('green'); }else{ jQuery(this) .addClass('gray'); } }) } //on load jwplay play if(jQuery('.popup .jwplayer-video') .length){ var id = jQuery('.popup .jwplayer-video .jwplayer') .attr('id'); var player = jwplayer(id); player.play(true); } //function for jwplay trigger play // if(jQuery('.video .jwplayer-video') .length){ // console.log(jQuery('.video .jwplayer-video') .length); // jQuery(window) .load(function(){ // var id = jQuery('.video .jwplayer-video .jwplayer') .attr('id'); // var player = jwplayer(id); // if(jQuery('.video .illustration') .length == 0){ // jQuery('.video .video_play') .click(function(){ // if(player.getState() != 'PLAYING'){ // player.play(true); // jQuery('.video_cover') .fadeOut(); // } // }); // } else { // jQuery('.video .video_play') .click(function(){ // var idd = jQuery(this) .closest('.video .illustration') .find('.jwplayer-video .jwplayer') .attr('id'); // var playerr = jwplayer(idd); // if (playerr.getState() != 'PLAYING'){ // playerr.play(true); // jQuery('.video .video_cover') .fadeOut(); // jQuery(this) .closest('.illustration') .find('.video_overlay') .fadeOut(); // jQuery(this) .closest('.illustration') .find('.video_play') .fadeOut(); // jQuery(this) .closest('.illustration') .find('.train_default') .fadeOut(); // jQuery(this) .closest('.illustration') .find('.train_preview') .fadeOut(); // } // }); // } // }) // } if(jQuery('.video .jwplayer-video') .length){ var id; var player; jQuery(".video") .click(function(){ id = jQuery(this).find("object").attr('id'); player = jwplayer(id); player.play(true); jQuery(this) .find('.video_overlay') .fadeOut(); jQuery(this) .find('.video_play') .fadeOut(); jQuery(this) .find('.train_default') .fadeOut(); jQuery(this) .find('.train_preview') .fadeOut(); jQuery(this) .find('.video_cover') .fadeOut(); }); } // function for dealing with the like and dislike buttons // if(jQuery('.social_buttons_flag') .length){ // jQuery('.social_buttons_flag') .delegate('.flag-like a','click',function(){ // var num_like = jQuery(this) .closest('.social_button') .find('.counter') .text(); // num_like = parseInt(jQuery.trim(num_like)); // if(jQuery(this) .hasClass('flag-action')){ // num_like++; // }else{ // num_like--; // } // jQuery(this) .closest('.social_button') .find('.counter') .text(num_like); // }) // jQuery('.social_buttons_flag') .delegate('.flag-dislike a','click',function(){ // var num = jQuery(this) .closest('.social_button') .find('.counter') .text(); // num = parseInt(jQuery.trim(num)); // if(jQuery(this) .hasClass('flag-action')){ // num++; // }else{ // num--; // } // jQuery(this) .closest('.social_button') .find('.counter') .text(num); // }) // } //share popup jQuery('.share_trigger') .click(function(){ jQuery('.share_overlay') .fadeIn(); }) jQuery('.node-type-container') .click(function(){ jQuery('.messages') .fadeOut(); }) var count = 0; jQuery('.upload_tpl>div') .each(function(){ if(count%2==0){ jQuery(this) .addClass('odd'); }else{ jQuery(this) .addClass('clear'); } count++; }) count = 0; jQuery("#node_sample_form_group_general_date>div") .each(function(){ if(count%2==0){ jQuery(this) .addClass('clear'); }else{ jQuery(this) .addClass('even'); } count++; }) count = 0; jQuery("#node_sample_form_group_patten_data>div") .each(function(){ if(count%2==0){ jQuery(this) .addClass('clear'); }else{ jQuery(this) .addClass('even'); } count++; }) count = 0; jQuery("#node_sample_form_group_rendering>div") .each(function(){ if(count%2==0){ jQuery(this) .addClass('clear'); }else{ jQuery(this) .addClass('even'); } count++; }) count = 0; jQuery("#node_sample_form_group_size_data>div") .each(function(){ if(count%2==0){ jQuery(this) .addClass('clear'); }else{ jQuery(this) .addClass('even'); } count++; }) // not login redirect if(jQuery('.node-type-notlog') .length){ jQuery('.menu_left .block-menu-block>.content>.menu-block-wrapper>.menu>li.first>a') .attr('href','/user/register'); } if(jQuery('.node-message-form').length){ if(jQuery('.i18n-en').length){ jQuery('.form-item-title label') .text(''); jQuery('.form-item-title label') .html("Subject *"); }else{ jQuery('.form-item-title label') .text(''); jQuery('.form-item-title label') .html("涓婚 *"); } } var search = jQuery('#block-views-search-text-block .field-content') .text(); jQuery('#edit-custom-search-blocks-form-1--2') .attr('placeholder',search); //change image for sample page var big_url = jQuery(".illustration").find("img").attr("src"); var big_url_show = jQuery(".illustration").find("a").attr("href"); var small_url; var small_url_show; jQuery(".switch a").click(function(){ small_url = jQuery(this).find("img").attr("src"); small_url_show = jQuery(this).attr("href"); // console.log(small_url); // console.log(small_url_show); jQuery(".illustration").find("img").attr("src",small_url); jQuery(".illustration").find("a").attr("href",small_url_show); jQuery(this).find("img").attr("src",big_url); jQuery(this).attr("href",big_url_show); big_url = small_url; big_url_show = small_url_show; return false; //disable href for small pictures }); }); // add btn class for bootstrap btn theming function addBtn (){ jQuery('#edit-submit , .user_login_form .form-actions input, #edit-submit:not(.navbar #edit-submit), .user_edit .form-submit, .page-node-add-sample #edit-submit, #comments .form-submit, .webform-client-form .form-actions input[type="submit"], .button a.flag, .wrapper_main_nav .views-field-field-live-chat-text .field-content,.contact_page .form-file input, .contact_page .form-managed-file input:not(input[type=file]),.contact_page .form-actions input').addClass('btn btn-primary'); } jQuery(window) .load(function(){ var pla = jQuery('.region-search #edit-submit') .val(); jQuery('.region-search #search-block-form .form-item-search-block-form input') .attr('placeholder',pla); jQuery('.region-search .icon-search') .click(function(){ jQuery('.region-search #edit-submit') .trigger('click'); }) }) jQuery(window) .load(function(){ var pla = jQuery('.region-search #edit-submit--2') .val(); jQuery('.region-search #edit-search-block-form--2') .attr('placeholder',pla); jQuery('.region-search .icon-search') .click(function(){ jQuery('.region-search #edit-submit--2') .trigger('click'); }) }) jQuery(document).ready(function($) { // if(jQuery('.video .jwplayer-video') .length){ // var id; // var player; // $(".video") .click(function(){ // id = jQuery(this).find("object").attr('id'); // jQuery(this) .find('.video_overlay') .fadeOut(); // jQuery(this) .find('.video_play') .fadeOut(); // jQuery(this) .find('.train_default') .fadeOut(); // jQuery(this) .find('.train_preview') .fadeOut(); // jQuery(this) .find('.video_cover') .fadeOut(); // }); // } function createPopup(content) { var template = '
'; $("body").append(template); $(".overlay, .popup.my-popup .popup_close ").click(function() { $(".overlay").remove(); $(".popup.my-popup").remove(); }); } $(".video_cover, .video_overlay, .train_default, .train_preview").click(function(e) { e.preventDefault(); createPopup( "
" ); $jwplayer = $(this).parents(".video").find("[name^=jwplayer]"); var file = jwplayer($jwplayer.attr("name")).config.file jwplayer("mypopupvideo").setup( { primary:"flash", file: file, height: "auto", width: "100%", autostart: true, modes: [ { type:"flash", src:"/sites/all/libraries/jwplayer/player.swf" }, { type:"html5" } ] } ); }); });