/*jslint browser: true*/ /*global $, jQuery*/ // load facebook window.fbAsyncInit = function() { //alert("this is the asyncinit in js.php"); if (FB.init) { } else { FB.init({ appId : 363508327070368, status : true, cookie : true, xfbml : true }); } FB.Event.subscribe('comment.create', function(response, widget) { //alert("you commented " + response); var url_to_hit = '/site/wp-content/plugins/wp-survey-and-quiz-tool/habitatseven_like_booster.php?'; url_to_hit += 'user_id=0&user_login=&url=' + encodeURIComponent(response); url_to_hit += '&social_media_site=facebook&comment=true'; //alert("The url to hit is " + url_to_hit); $.ajax({ url: url_to_hit, async: true, cache: false, dataType: 'text', success: function( data ) { alert('Thanks, you just got five points!'); }, error: function( data ) { //alert( "ERROR: " + data.responseText + " and " + data.responseStatus); } }); } ); FB.Event.subscribe('edge.create', function(response) { //alert("you liked " + response); var url_to_hit = '/site/wp-content/plugins/wp-survey-and-quiz-tool/habitatseven_like_booster.php?'; url_to_hit += 'user_id=0&user_login=&url=' + encodeURIComponent(response); url_to_hit += '&social_media_site=facebook'; //alert("The url to hit is " + url_to_hit); $.ajax({ url: url_to_hit, async: true, cache: false, dataType: 'text', success: function( data ) { alert('Thanks, you just got a point!'); }, error: function( data ) { //alert( "ERROR: " + data.responseText + " and " + data.responseStatus); } }); } ); twttr.events.bind('tweet', function(event) { //alert('You tweeted ' + event); var url_to_hit = '/site/wp-content/plugins/wp-survey-and-quiz-tool/habitatseven_like_booster.php?'; url_to_hit += 'user_id=0&user_login=&url=' + encodeURIComponent('http://www.expeditionarctic.ca/site/plan_de_lecon-lesson_plan/lecon_6-lesson_6/'); url_to_hit += '&social_media_site=twitter'; //alert("The url to hit is " + url_to_hit); $.ajax({ url: url_to_hit, async: true, cache: false, dataType: 'text', success: function( data ) { alert('Thanks, you just got a point!'); }, error: function( data ) { //alert( "ERROR: " + data.responseText + " and " + data.responseStatus); } }); }); jQuery('#registerform p').hide(); jQuery('#reg_passmail').show(); //alert('Ok things are up'); }; (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "https://connect.facebook.net/en_US/all.js#xfbml=1&status=0&appId=363508327070368"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); // smooth scroll function scrollTo(element_id, offset) { 'use strict'; var destination = $(element_id).offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination - offset}, 'fast', function () {}); return false; } // collection stuff // location photo/video loading function load_content(type, div_ID) { 'use strict'; var wrapdiv, divclass, contentdiv, newcontent; wrapdiv = '#' + type + 'wrap'; divclass = '.' + type; contentdiv = '#' + type + 's'; if (type === 'video') { newcontent = $(div_ID).html(); $('#videowrap #placeholder').html(newcontent); } else { $(divclass).fadeOut(); $(div_ID).fadeIn(); } $(wrapdiv).slideDown(); scrollTo(contentdiv, 200); } // page scripts $(document).ready(function () { 'use strict'; $(window).scroll(function () { $('.iceberg.fademe').animate({ opacity: 0.25 }); }).click(function () { $('.iceberg.fademe').animate({ opacity: 0.25 }); }); // link functions jQuery('#collection .post').bind("mouseenter", function () { $(this).animate({ backgroundColor: '#f5f5f5' }, 200); }).bind("mouseleave", function () { $(this).animate({ backgroundColor: 'transparent' }, 200); }); $('.hotspot .toggle').mouseover(function () { $('.details').fadeOut('fast'); $(this).siblings('.details').fadeIn('fast'); }); $('.hotspot .toggle').mouseout(function () { $('.details').delay(300).fadeOut('fast'); }); $('.introdiv').click(function () { $(this).fadeOut('fast'); }); $('.close').click(function (e) { e.preventDefault(); }); // back to top $('.backup').click(function (e) { e.preventDefault(); scrollTo('#top', 0); }); $('#photos .backup').click(function (e) { e.preventDefault(); $('#photowrap').slideUp('fast', function() { scrollTo('#top', 0); }); }); $('#videos .backup').click(function (e) { e.preventDefault(); $('#videowrap #placeholder').empty(); $('#videowrap').slideUp('fast', function() { scrollTo('#top', 0); }); }); // jquery ui accordion $('.accordion').accordion({ heightStyle: 'content' }); // tooltips $('.tiptrigger').bind("mouseenter", function () { $(this).siblings('.tip').animate({ opacity: 1 }, 200); }).bind("mouseleave", function () { $(this).siblings('.tip').animate({ opacity: 0 }, 200); }); // slider images $( "#slider" ).slider({ min: 1, max: 5, value: 1, slide: function( event, ui ) { var image_class = 'phase' + ui.value; $('#sliderwrap #image').removeClass().addClass(image_class); } }); // login validation jQuery('#loginform').submit(function(e){ var errors; jQuery('#loginform input').each(function(){ var val = jQuery(this).val() if( ! val ) { errors = true; } }); if( errors ) { e.preventDefault(); alert('Please enter your username and password.'); } }); });