MyBB Community Forums

Full Version: jQuery problems for mybb 1.8
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello guys, I'm studying the problems about a script that I use because I would like to continue using it.
Some one can help me?
The problem is: If I don't use this script, the text editor and moderation inline works but some effects and funcionalities don't. Else, text editor and moderation inline don't work but the effects and funcionalities works.
Any idea?
*I have already tried to remove all "jQuery.noConflict();" but don't work.
script:

/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie=function(name,value,options){if(typeof value!="undefined"){options=options||{};if(value===null){value="";options.expires=-1;}var expires="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var date;if(typeof options.expires=="number"){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires="; expires="+date.toUTCString();}var path=options.path?"; path="+(options.path):"";var domain=options.domain?"; domain="+(options.domain):"";var secure=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,secure].join("");}else{var cookieValue=null;if(document.cookie&&document.cookie!=""){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+"=")){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};

/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
*/
jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});

jQuery(document).ready(function($)
{
    // Make the jQuery modal login redirect you back to the page you're currently on //
    $('#loginModal input[name="url"]').attr("value", window.location);
    // /Login redirect //

    // Modal Boxes //
    $('a[name="modal"]').on('click', function(event)
    {
        event.preventDefault();
        
        var target = $(this).attr('rel');
        
        // Set up the shadowing
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
        $('#mask').css({'width': maskWidth, 'height': maskHeight});
        $('#mask').fadeIn(1000);    
        $('#mask').fadeTo("slow", 0.8);  
        
        // Position the actual modal
        var winH = $(window).height();
        var winW = $(window).width();
        $(target).css('top',  (winH / 2) - ($(target).height() / 2));
        $(target).css('left', (winW / 2) - ($(target).width() / 2));
        $(target).fadeIn(2000); 
    });
    
    $('.modalBox a[rel="closeModal"]').on('click', function(event)
    {
        event.preventDefault();
        $('#mask, .modalBox').hide();
    }); 
    
    $('#mask').on('click', function ()
    {
        $(this).hide();
        $('.modalBox').hide();
    }); 
    // /Modal Boxes //
});
        

/*
* fancyCollapses 1.0 - jSnippet by Jorge Lainfiesta
* Copyright 2010 Audentio Design
* http://audentio.com/
*
*/

expandables=null;(function(a){if(jQuery.cookie){jQuery(document).ready(function(){var b="fancyCollapses_collapsed_elmnts",g="|",h=",";var c=a.cookie(b);if(c!=""&&c!=null){var l=c.split(g);for(i=0;i<l.length;i++){var j=l[i].split(h);if(typeof j[0]!="undefined"&&j[0]!=""){if(j[2]=="m"){var d=a(j[1]).attr("src");if(typeof d!="undefined"){d=d.replace("collapse","collapse_collapsed");a(j[1]).attr("src",d);a(j[1]).css("cursor","pointer");var e=a(j[0]);var k=e.closest("table").attr("cellpadding");var f=e.closest("table").attr("cellspacing");e.closest("table").attr("cellspacing","0");e.addClass("fancyCollapses_modded").wrapInner("<tr><td style='padding: 0; margin: 0; width: 100%'><div><table width='100%' border='0' cellspacing='"+f+"' cellpadding='"+k+"'></table></div></td></tr>");e.children().children().children().hide()}}else{a(j[0]).hide()}a(j[1]).addClass("fancyCollapses_collapser_collapsed");a(j[0]).addClass("fancyCollapses_collapsed")}}}})}a.fn.fancyCollapses=function(b){var c=a.extend({},a.fn.fancyCollapses.defaults,b);return this.each(function(){var f="fancyCollapses_collapsed_elmnts",k="|",l=",";function s(o,v,x){var w=a.cookie(f);if(w==null){w=""}var u=w+k+o+l+v+l+x;a.cookie(f,u)}function t(o,u,w){var v=a.cookie(f);var x=k+o+l+u+l+w;v=v.replace(x,"");a.cookie(f,v)}var m=a(this);var e=a.meta?a.extend({},c,m.data()):c;var r="",p="",g,q,d=false;r=m.attr("id");if(e.collapser){p=e.collapser}if(!r){if(!e.collapser){var h=new Error();h.name="fancyCollapses error";h.message="No collapser specified";throw (h)}g=m}else{d=true;r="#"+r;g=a(r);if(e.isTable){p=r.replace("_e","_img");if(!g.hasClass("fancyCollapses_modded")){var n=g.closest("table").attr("cellpadding");var j=g.closest("table").attr("cellspacing");g.closest("table").attr("cellspacing","0");g.wrapInner("<tr><td style='padding: 0; margin: 0; width: 100%'><div><table width='100%' border='0' cellspacing='"+j+"' cellpadding='"+n+"'></table></div></td></tr>")}g=a(r).children().children().children()}else{if(!e.collapser){p=r+"_btn"}}}q=a(p);q.css("cursor","pointer");g.width("100%");q.click(function(){if(!q.hasClass("fancyCollapses_collapser_collapsed")){g.slideUp(e.speed,e.easing);if(e.isTable){var o=q.attr("src");o=o.replace("collapse","collapse_collapsed");q.attr("src",o)}q.addClass("fancyCollapses_collapser_collapsed");g.addClass("fancyCollapses_collapsed");if(d){if(jQuery.cookie){var u="n";if(e.isTable){u="m"}s(r,p,u)}}}else{g.slideDown(e.speed,e.easing);if(e.isTable){var o=q.attr("src");o=o.replace("_collapsed","");q.attr("src",o)}q.removeClass("fancyCollapses_collapser_collapsed");g.removeClass("fancyCollapses_collapsed");if(d){if(jQuery.cookie){var u="n";if(e.isTable){u="m"}t(r,p,u)}}}})})};a.fn.fancyCollapses.defaults={easing:"linear",speed:"normal",collapser:"",isTable:true}})(jQuery);

jQuery.noConflict();
jQuery(document).ready(function($){       
	$(".tborder  tbody[id$='_e']").fancyCollapses({easing:"easeInOutQuart",speed:"normal"});

$(function(){
	var items = (Math.floor(Math.random() * ($('#testimonials li').length)));
	$('#testimonials li').hide().eq(items).show();
	
  function next(){
		$('#testimonials li:visible').delay(5000).fadeOut('slow',function(){
			$(this).appendTo('#testimonials ul');
			$('#testimonials li:first').fadeIn('slow',next);
    });
   }
  next();
});

jQuery(document).ready(function($) {
	var $entsearch = $( '#ent-search' ),
		$entsearchinput = $entsearch.find('input.ent-search-input'),
		$body = $('html,body'),
		openSearch = function() {
			$entsearch.data('open',true).addClass('ent-search-open');
			$entsearchinput.focus();
			return false;
		},
		closeSearch = function() {
			$entsearch.data('open',false).removeClass('ent-search-open');
		};

	$entsearchinput.on('click',function(e) { e.stopPropagation(); $entsearch.data('open',true); });

	$entsearch.on('click',function(e) {
		e.stopPropagation();
		if( !$entsearch.data('open') ) {

			openSearch();

			$body.off( 'click' ).on( 'click', function(e) {
				closeSearch();
			} );

		}
		else {
			if( $entsearchinput.val() === '' ) {
				closeSearch();
				return false;
			}
		}
	});

});

		jQuery(window).scroll(function(){
		if (jQuery(this).scrollTop() > 1) {
			jQuery('.wdttop').css({bottom:"25px"});
		} else {
			jQuery('.wdttop').css({bottom:"-100px"});
		}
	});
	jQuery('.wdttop').click(function(){
		jQuery('html, body').animate({scrollTop: '0px'}, 800);
		return false;
	});


$('.panelbutton').on('click', function(event){
  event.preventDefault();
  $('.panell').slideToggle('fast', function(event){
    if($(this).is(':visible')){
      $('.panelbutton').html('Options -');
    } else {
      $('.panelbutton').html('Options +');
    }
  });
});

jQuery.noConflict();
jQuery(function($) {
    $(".clickedbuttons").hide();
    $(".clickbutton").click(function() {
        $(".sidebar").animate({height: "hide", opacity: 0}, 250,
            function() {
                $(".forums").animate({width: "100%"}, 250);
            });
        $(this).hide();
        $(".clickedbuttons").show();
        $.cookie("sidebar","collapsed", {expires: 365});
        return false;
    });
    $(".clickedbuttons").click(function() {
        $(".forums").animate({width: "77%"}, 250,
            function() {
                $(".sidebar").animate({height: "show", opacity: 1}, 250);
            });
        $(this).hide();
        $(".clickbutton").show();
        $.cookie("sidebar","expanded", {expires: 365});
        return false;
    });
    if($.cookie("sidebar") == "collapsed") {
        $(".clickbutton").hide();
        $(".clickedbuttons").show();
        $(".forums").css("width","100%");
        $(".sidebar").hide();
    };
});

jQuery.noConflict();
jQuery(document).ready(function($) {
var speed = 600,
    currSel = 0,
    itemCount = $('.carousel ul li')
                    .length,
    itemWidth = $('.carousel ul li')
                  .css('width')
                    .split('px')[0] ;
$('.navNext').on('click',function(){
  currSel =(currSel+1)%itemCount;
  console.log((currSel*itemWidth));
  $('.carousel ul')
    .animate(
      {marginLeft:
       '-'
       +(currSel*itemWidth)
       +'px'}
      ,speed);
});
$('.navPrev').on('click',function(){
  currSel =((currSel==0)
                ?itemCount
                :(currSel))-1 ;
  console.log((currSel*itemWidth));
  $('.carousel ul')
    .animate(
      {marginLeft:
       '-'
       +(currSel*itemWidth)
       +'px'}
      ,speed);
});
});

jQuery(document).ready(function($) {
    if ($(".headavatar, .pbavatar").attr("src") === "") {
        $(".headavatar, .pbavatar").attr("src", "images/df/defaultavatar.png");
    }
}); 

jQuery(document).ready(function() {

    jQuery('a[href=#top]').click(function(){
        jQuery('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
});
});
@EDIT
I did some tests and these functions below works normally:

jQuery(document).ready(function($)
{
    // Make the jQuery modal login redirect you back to the page you're currently on //
    $('#loginModal input[name="url"]').attr("value", window.location);
    // /Login redirect //

    // Modal Boxes //
    $('a[name="modal"]').on('click', function(event)
    {
        event.preventDefault();
        
        var target = $(this).attr('rel');
        
        // Set up the shadowing
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
        $('#mask').css({'width': maskWidth, 'height': maskHeight});
        $('#mask').fadeIn(1000);    
        $('#mask').fadeTo("slow", 0.8);  
        
        // Position the actual modal
        var winH = $(window).height();
        var winW = $(window).width();
        $(target).css('top',  (winH / 2) - ($(target).height() / 2));
        $(target).css('left', (winW / 2) - ($(target).width() / 2));
        $(target).fadeIn(2000); 
    });
    
    $('.modalBox a[rel="closeModal"]').on('click', function(event)
    {
        event.preventDefault();
        $('#mask, .modalBox').hide();
    }); 
    
    $('#mask').on('click', function ()
    {
        $(this).hide();
        $('.modalBox').hide();
    }); 
    // /Modal Boxes //
}); 


$('.panelbutton').on('click', function(event){
  event.preventDefault();
  $('.panell').slideToggle('fast', function(event){
    if($(this).is(':visible')){
      $('.panelbutton').html('Options -');
    } else {
      $('.panelbutton').html('Options +');
    }
  });
});


jQuery(document).ready(function($) {
    if ($(".headavatar, .pbavatar").attr("src") === "") {
        $(".headavatar, .pbavatar").attr("src", "images/df/defaultavatar.png");
    }
}); 

Any idea to "update" the others functions?