// Turn off fnacy box keypresses $.fn.fancybox.defaults.enableEscapeButton = false; // We should remove once JQuery UI is updated $.extend($.ui.autocomplete, { escapeRegex: function(value) { return value.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1"); }, filter: function(array, term) { var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i"); return $.grep(array, function(value) { return matcher.test(value.label || value.value || value); }); } }); Cufon.replace('#content h1', { hover: 'true', fontFamily: 'Gotham Book' }); Cufon.replace('#header h1', { hover: 'true', fontFamily: 'Gotham Bold' }); function setup_tooltips() { // tooltip for question mark icons var version = parseInt($.browser.version.substr(0, 1)); var tooltip_elements = 'span.tooltip'; if ($.browser.msie && version == 6) { return false; } else { $(tooltip_elements).unbind(); $(tooltip_elements).hover( function() { this.tip = this.title; $(this).append('
' + this.tip + '
'); this.title = ""; this.width = $(this).width(); $(this).find('.tooltip-show').css({ left: this.width - 22 }); $('.tooltip-show').fadeIn(400); }, function() { $('.tooltip-show').fadeOut(400); $(this).children().remove(); this.title = this.tip; }); } } $(document).ready(function() { //video previews domain = window.location.href.replace(/http:\/\/([^\/]+)\/.*/i,'$1'); var videoUrl = 'video=http://'+ domain + escape($('a.lightboxVideo').attr('href')) + '&standalone=true'; $('a.lightboxVideo').fancybox({ 'padding': 10, 'autoScale': true, 'transitionIn': 'elastic', 'transitionOut': 'elastic', 'title': false, 'titleShow': false, 'width': 700, 'height': 400, 'type': 'swf', 'swf': { 'allowFullScreen': true, 'flashvars': videoUrl, wmode: 'transparent' }, 'href': '/flash/video.swf', 'centerOnScroll': true }); setup_tooltips(); // Template Choices $('.template label img').hide(); $('.template label img').css({ position: 'absolute' }); $('.template input:radio:checked').parent().children('img').show(); $('.template input').click(function() { $('.template label img').hide(); $(this).parent().children('img').fadeIn('fast'); var imgHeight = $(this).parent().children('img').height() + 100 ; $('#main-form').css({'min-height' : imgHeight + 'px'}); }); //Field Types on form creator if ($('#field-type').length > 0) { var current_help = ''; $('.field-help').hide(); $('#' + $('#field-type option:selected').val()).show(); current_help = $('#' + $('#field-type option:selected').val()); $('#field-type').change(function() { $(current_help).hide('fast'); $('#' + $('#field-type option:selected').val()).show('fast'); current_help = $('#' + $('#field-type option:selected').val()); }); } // Advanced Publishing Options //hide the options if you click outside of the grey box (needs improving to include the tinymce window) $('#main-form').click(function(e) { //Hide the menus if visible if ($(".show-advanced a.advanced").hasClass('open')) { e.stopPropagation(); $("#advanced").stop(true, true).slideUp("fast"); $(".show-advanced a.advanced").removeClass("open"); } }); $("#advanced").hide(); $("legend.advanced").hide(); $(".show-advanced").append("Advanced"); $(".show-advanced a.advanced").click( function() { if ($(".show-advanced a.advanced").hasClass('open')) { $("#advanced").stop(true, true).slideUp("fast"); $(".show-advanced a.advanced").removeClass("open"); } else { $("#advanced").stop(true, true).slideDown("fast"); $(".show-advanced a.advanced").addClass("open"); $(".show-advanced a.advanced.open").fadeIn("fast"); } }); $('body#assets.index .file').click(function() { document.location = $(this).find("a.show").attr('href'); }); // slot form lightbox, used in nodes cms forms $('a.slot_link').fancybox({ 'autoScale': false, // 'transitionIn' : 'none', // 'transitionOut' : 'none', 'title': false, 'centerOnScroll': true, 'hideOnOverlayClick': true, 'hideOnContentClick': false, 'onComplete': Component.fancy_open_slot }); // Preview preview_link = $('Preview'); $("body#nodes.show #node_submit").after(preview_link); // Using selectors as latest version of webkit does not like binding to objects $('a.preview').fancybox({ 'autoDimensions': false, 'width': '95%', 'height': '95%' }); $('a.preview').click(get_preview_html); // Original code // preview_link.fancybox({ // 'autoDimensions' : false, // 'width' : '95%', // 'height' : '95%' // }); // preview_link.click(get_preview_html); // Change the component $('select.component-selector').bind('change', open_component_form); // Set up table initComponentTable(); // Set up multi files // Hide the last multi file li which is empty and used as a template $('li.multi-file:last-child').hide(); // Hide the file details elements $('li.multi-file .file-form').hide(); // Make them sortable $('.multi-file-files ol').sortable({ axis: 'y', handle: 'img' }); // Add emptys div for browsers/preview $('body').append('