(function( window, $, undefined ) { var SITE = window.SITE = {}, $window = $(window), $html = $(document.documentElement), $body = $(document.body); common = SITE.common = {}; common = { init: function() { console.log('common init'); $(".ttipWide").tooltip({ track: true, tooltipClass:'myTooltipWide', content: function () { return $(this).prop('title'); } }); $(".ttip").tooltip({ track: true, content: function () { return $(this).prop('title'); } }); $(".fancybox").fancybox(); common.ZeroClipboard(); // Load page specific common.loader( $body.data('page')); }, ZeroClipboard: function() { var $buttons = $('button[data-clipboard-text]'); if (!$buttons.length) return false; var client = new ZeroClipboard($buttons); client.on( "ready", function( readyEvent ) { client.on( "aftercopy", function( e ) { var $this = $(e.target), altText = $this.data('alt-text') || "", backupText = $this.text(); if (altText.length && !$this.attr('disabled')) { $this.hide().text( $this.data('alt-text') ).attr('disabled',true).fadeIn('fast'); setTimeout(function() { $this.hide().text( backupText ).attr('disabled',false).fadeIn(); }, 2000); } console.log( 'Copied ' + e.data["text/plain"] ); } ); } ); }, myAlert: function(output_msg, title_msg) { title_msg = title_msg || 'Alert'; output_msg = output_msg || 'No Message to Display.'; $("
").html(output_msg).dialog({ title: title_msg, resizable: false, modal: true, buttons: { "Ok": function() { $( this ).dialog( "close" ); } } }); }, loader: function( page ) { if ( page !== "" && SITE[page] ) { console.log('common loading', page); SITE[page].init(); } } }; $(document).ready( common.init ); })( window, jQuery );