// JavaScript Document function init_page_organizer(){ if($('#org_form').length){ // --- Header Buttons ---- if($('#dialog').length){ if($('#project_highlight_title_btn_02').length || $('#project_highlight_title_btn_021').length){ $('#project_highlight_title_btn_02, #project_highlight_title_btn_021').click(function(e){ var t = ''; var btn_t = 'OK'; switch(Number(global_js_params.lang)){ default: case 1: t = 'Permalink'; btn_t = 'OK'; break; case 2: t = '連結網址'; btn_t = '確定'; break; case 3: t = '链结网址'; btn_t = '确定'; break; } $( "#dialog" ).html('
'); $( "#dialog" ).dialog({ open: function(){ $('.ui-widget-overlay').hide().fadeIn(); $('.ui-widget-overlay').bind('click', function() { $('#dialog').dialog('close'); }) }, show: { effect: "clip", duration: 200 }, hide: { effect: "clip", duration: 200 }, resizable: false, autoOpen: true, draggable: false, width: 'auto', modal: true, closeOnEscape: false, title: t, buttons: [ { text: btn_t, click: function() { $( this ).dialog( "close" ); } } ] }); }); //$('#tnc_details').click(function(e){ } // if($('#tnc_details').length){ } // if($('#dialog').length){ if($('#project_highlight_title_btn_03').length || $('#project_highlight_title_btn_031').length){ $('#project_highlight_title_btn_03, #project_highlight_title_btn_031').parent().hover(function(e){ if($(this).attr("class") == 'color'){ $(this).find('img').attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart_saved_grey.png'); } else { $(this).find('img').attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart_over.png'); } }, function(e){ if($(this).attr("class") == 'noclass'){ $(this).find('img').attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart.png'); } else { $(this).find('img').attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart_grey.png'); } }); $('#project_highlight_title_btn_03, #project_highlight_title_btn_031').parent().click(function(e){ var removeBoo = false; if($(this).attr("class") == 'color'){ $(this).switchClass('color', 'noclass', 0); removeBoo = true; $(this).find('img').stop().attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart.png'); } else { $(this).switchClass('noclass', 'color', 0); $(this).find('img').stop().attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart_saved.png'); } var removeBoo = false; //if($(this).attr("src").indexOf("_over") !=-1){ if($(this).attr("class") == 'color'){ $(this).switchClass('color', 'noclass', 0); removeBoo = true; $(this).stop().attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart_grey.png'); } else { $(this).switchClass('noclass', 'color', 0); $(this).stop().attr("src", local_url+'lib/img/projects/project_highlight_title_btn_heart_over.png'); } if($(this).parent().attr('href') == 'javascript:void(0);'){ // -------- AJAX ------ $.ajax({ url: local_url+'lib/ajax/userheart/?r='+((removeBoo) ?1:0), headers: { 'X-Etickets-Key': $('#hh').val() }, data: $('form').serialize(), type:"POST", dataType:'json', beforeSend: function(msg){ // }, complete: function(msg){ // }, success: function(json_data){ // //alert(json_data.status); }, error:function(xhr, ajaxOptions, thrownError){ // } }); // -- END --- AJAX ---- } }); } // END --- Header Buttons ---- if($('#etickets_project_googlemap_container_frontground').length){ var ll = $('#etickets_project_googlemap_container').attr('data-articleid').split(','); var myLatlng = new google.maps.LatLng(ll[0], ll[1]); var map = new google.maps.Map(document.getElementById('etickets_project_googlemap_container'), { zoom: 15, center: myLatlng, disableDefaultUI: true, clickableLabels:false, scrollwheel: false, navigationControl: false, mapTypeControl: false, scaleControl: false, draggable: false, editable:false, clickable: false, mapTypeId: google.maps.MapTypeId.ROADMAP }); var geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': $('#etickets_project_googlemap_container').attr('data-address')}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); } else { // NO RESULT //alert('Geocode was not successful for the following reason: ' + status); geocoder.geocode( { 'address': $('#etickets_project_googlemap_container').attr('data-address-bk')}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); } else { // NO RESULT } }); } }); $('#etickets_project_googlemap_container_frontground').hover( function() { $(this).css('cursor', 'pointer'); $(this).stop().animate({"opacity": "0.6"}, "fast"); }, function() {$(this).stop().animate({"opacity": "0.7"}, "fast"); }); $('#etickets_project_googlemap_container_frontground').click(function(e){ window.open($('#etickets_project_googlemap_container').attr('data-link')); }); // } // if($('#etickets_project_googlemap_container_frontground').length){ $('.all_project_list_links').each(function(){ $(this).hover( function() { $(this).find('svg, img').stop().animate({"opacity": "0.6"}, 200); }, function() {$(this).find('svg, img').stop().animate({"opacity": "1.0"}, 100); }); }); $('.org_social, .all_project_list_links img').each(function(){ $(this).hover( function() { $(this).stop().animate({"opacity": "0.6"}, 300); }, function() {$(this).stop().animate({"opacity": "1.0"}, 200); }); }); } // if($('#org_form').length){ }