Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- wp_deregister_script( 'jquery' ); // unregistered key jQuery
- wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', false, '1.4.4'); // register key jQuery with URL of Google CDN
- wp_enqueue_script( 'jquery' ); // include jQuery
- ?>
- <?php if ( is_singular() ) wp_enqueue_script('comment-reply'); ?>
- <?php wp_head(); ?>
- <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-ui-1.8.6.custom.min.js"></script>
- <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.tools.min.js"></script>
- <script type="text/javascript">
- // function that writes the list order to a cookie
- function saveOrder() {
- jQuery(".column").each(function(index, value){
- var colid = value.id;
- var cookieName = "cookie-" + colid;
- // Get the order for this column.
- var order = jQuery('#' + colid).sortable("toArray");
- // For each portlet in the column
- for ( var i = 0, n = order.length; i < n; i++ ) {
- // Determine if it is 'opened' or 'closed'
- var v = jQuery('#' + order[i] ).find('.portlet-content').is(':visible');
- // Modify the array we're saving to indicate what's open and
- // what's not.
- order[i] = order[i] + ":" + v;
- }
- jQuery.cookie(cookieName, order, { path: "/", expiry: new Date(2012, 1, 1)});
- });
- }
- // function that restores the list order from a cookie
- function restoreOrder() {
- jQuery(".column").each(function(index, value) {
- var colid = value.id;
- var cookieName = "cookie-" + colid
- var cookie = jQuery.cookie(cookieName);
- if ( cookie == null ) { return; }
- var IDs = cookie.split(",");
- for (var i = 0, n = IDs.length; i < n; i++ ) {
- var toks = IDs[i].split(":");
- if ( toks.length != 2 ) {
- continue;
- }
- var portletID = toks[0];
- var visible = toks[1]
- var portlet = jQuery(".column")
- .find('#' + portletID)
- .appendTo(jQuery('#' + colid));
- if (visible === 'false') {
- }
- }
- });
- }
- // function that writes the list order to a cookie
- // set the list selector
- var setSelector = "ul.widgets";
- // set the cookie name
- var setCookieName = "listOrder";
- // set the cookie expiry time (days):
- var setCookieExpiry = 7;
- // function that writes the list order to a cookie
- function getOrder_s() {
- // save custom order to cookie
- jQuery.cookie(setCookieName, jQuery(setSelector).sortable("toArray"), { expires: setCookieExpiry, path: "/" });
- }
- // function that restores the list order from a cookie
- function restoreOrder_s() {
- var list = jQuery(setSelector);
- if (list == null) return
- // fetch the cookie value (saved order)
- var cookie = jQuery.cookie(setCookieName);
- if (!cookie) return;
- // make array from saved order
- var IDs = cookie.split(",");
- // fetch current order
- var items = list.sortable("toArray");
- // make array from current order
- var rebuild = new Array();
- for ( var v=0, len=items.length; v<len; v++ ){
- rebuild[items[v]] = items[v];
- }
- for (var i = 0, n = IDs.length; i < n; i++) {
- // item id from saved order
- var itemID = IDs[i];
- if (itemID in rebuild) {
- // select item id from current order
- var item = rebuild[itemID];
- // select the item according to current order
- var child = jQuery("ul.widgets.ui-sortable").children("#" + item);
- // select the item according to the saved order
- var savedOrd = jQuery("ul.widgets.ui-sortable").children("#" + itemID);
- // remove all the items
- child.remove();
- // add the items in turn according to saved order
- // we need to filter here since the "ui-sortable"
- // class is applied to all ul elements and we
- // only want the very first! You can modify this
- // to support multiple lists - not tested!
- jQuery("ul.widgets.ui-sortable").filter(":first").append(savedOrd);
- }
- }
- }
- jQuery(function() {
- // widgets/sortables
- jQuery(".column").sortable({
- connectWith: ['.column'],
- cursor: 'move',
- handle: 'h3',
- opacity: 0.80,
- tolerance: 'pointer',
- items: '.cat-widget',
- revert: true,
- stop: function() { saveOrder(); }
- });
- restoreOrder();
- // sidebar/sortables
- jQuery(".widgets").sortable({
- cursor: 'move',
- handle: 'h2',
- items: '.widget',
- opacity: 0.80,
- tolerance: 'pointer',
- revert: true,
- update: function() { getOrder_s(); }
- });
- restoreOrder_s();
- // Layout options feature
- jQuery('a#options').click(function (){
- if ((jQuery('.layout_options')).is(':hidden')) {
- jQuery('.layout_options').fadeIn('normal');
- } else {
- jQuery('.layout_options').fadeOut('normal');
- }
- });
- jQuery('.cancel a').click(function() {
- jQuery('#wrapper').fadeTo('fast', 1.0);
- jQuery('.layout_options').fadeOut('normal');
- });
- jQuery('a#reset').click(function() {
- jQuery('.cat-widget').each( function() {jQuery.cookie(jQuery(this).attr('id'), null, { path: '/', expires: 100 }); jQuery(this).show()});
- jQuery('.box_a').each( function() {jQuery.cookie(jQuery(this).attr('id'), null, { path: '/', expires: 100 }); jQuery(this).show()});
- jQuery('.widgets li').each (function() {jQuery.cookie(jQuery(this).attr('id'), null, { path: '/', expires: 100 }); jQuery(this).show()});
- jQuery('.layout_options').fadeOut('normal');
- jQuery('#wrapper').fadeTo('fast', 1.0);
- });
- // done.
- // Pages Drop Down
- jQuery("#topnav ul ul").css({display: "none"}); // Opera Fix
- jQuery("#topnav li").hover(function(){
- if (jQuery(this).parent().parent().attr("id") == 'topnav') {
- jQuery(this).removeClass('active-page');
- jQuery(this).addClass('active-page');
- }
- jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(500);
- },function(){
- if (jQuery(this).parent().parent().attr("id") == 'topnav') {
- jQuery(this).removeClass('active-page');
- }
- jQuery(this).find('ul:first').css({visibility: "hidden"});
- });
- // End
- // Categories Drop Down
- jQuery("#menu ul ul").css({display: "none"}); // Opera Fix
- jQuery("#menu li").hover(function(){
- if (jQuery(this).parent().parent().attr("id") == 'menu') {
- jQuery(this).removeClass('active-cat');
- jQuery(this).addClass('active-cat');
- }
- jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(500);
- },function(){
- if (jQuery(this).parent().parent().attr("id") == 'menu') {
- jQuery(this).removeClass('active-cat');
- }
- jQuery(this).find('ul:first').css({visibility: "hidden"});
- });
- // End
- /* various widget actions */
- jQuery('.minimize').click(function() {
- jQuery(this).parent('h3').next('.container').toggle();
- });
- jQuery('.Sminimize').click(function() {
- jQuery(this).parent('h2').next().toggle();
- });
- jQuery('.Wminimize').click(function() {
- jQuery(this).parent('h2').next().toggle();
- });
- jQuery('.close').click(function() {
- jQuery(this).parent('h3').parent('.cat-widget').fadeOut('slow');
- jQuery.cookie(jQuery(this).parent('h3').parent('.cat-widget').attr('id'), 'closed', { path: '/', expires: 100 });
- return false;
- });
- jQuery('.Sclose').click(function() {
- jQuery(this).parent('h2').parent().fadeOut('slow');
- jQuery.cookie(jQuery(this).parent('h2').parent('.box_a').attr('id'), 'closed', { path: '/', expires: 100 });
- return false;
- });
- jQuery('.Wclose').click(function() {
- jQuery(this).parent('h2').parent().fadeOut('slow');
- jQuery.cookie(jQuery(this).parent('h2').parent('li').attr('id'), 'closed', { path: '/', expires: 100 });
- return false;
- });
- jQuery('.cat-widget').each( function() {
- var cat_ID = jQuery(this).attr('id');
- if (jQuery.cookie(cat_ID) == 'closed') jQuery(this).hide();
- });
- jQuery('.box_a').each( function() {
- var box_ID = jQuery(this).attr('id');
- if (jQuery.cookie(box_ID) == 'closed') jQuery(this).hide();
- });
- jQuery('.widgets li').each (function() {
- var sidebar_ID = jQuery(this).attr('id');
- if (jQuery.cookie(sidebar_ID) == 'closed') jQuery(this).hide();
- });
- /* clear form */
- jQuery('.clearfield').each(function() {
- var default_value = this.value;
- jQuery(this).css('color', '#666'); // this could be in the style sheet instead
- jQuery(this).focus(function() {
- if(this.value == default_value) {
- this.value = '';
- }
- });
- jQuery(this).blur(function() {
- if(this.value == '') {
- this.value = default_value;
- }
- });
- });
- // video thumbs
- jQuery('.videothumb').bind('mouseenter', function() {jQuery(this).children('.playit').children('a').show()});
- jQuery('.videothumb').bind('mouseleave', function() {jQuery(this).children('.playit').children('a').hide()});
- // more stories
- jQuery('ul.more_stories li').css({'display': 'none'});
- jQuery("ul.more_stories").each(function(){
- jQuery(this).children('li').slice(0, <?php echo $comfy['moreitems']; ?>).show();
- });
- /* control visible stories */
- jQuery('.minus').click(function() {
- jQuery(this).parent().next('ul').children('li:visible:last').hide();
- });
- jQuery('.plus').click(function() {
- jQuery(this).parent().next('ul').children('li:hidden:first').show();
- });
- // append top menu
- jQuery("#topnav ul:first").prepend('<li class="left"></li>');
- jQuery("#topnav ul:first").append('<li class="right"></li>');
- // featured 1
- jQuery("span.overlay").fadeTo(1, 0.70);
- jQuery("ul.items").tabs(".pane", {
- effect: "fade",
- fadeInSpeed: 500,
- fadeOutSpeed: 500,
- rotate: true
- }).slideshow({autoplay: true, interval: 4000, clickable: false});
- // featured 2
- jQuery("ul.featuredposts").tabs(".featuredposts_content", {
- effect: "default",
- rotate: true
- }).slideshow({autoplay: true, interval: 4000, clickable: false});
- });
- </script>
- <?php if (defined('AJAX_COMMENTS_URL')) : ?>
- <?php
- print '<script type="text/javascript" src="'. AJAX_COMMENTS_URL .'/jquery/jquery.js"></script>'."\n";
- print '<script type="text/javascript" src="'. AJAX_COMMENTS_URL .'/ajax-comments.js.php"></script>'."\n";
- ?>
- <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment