MyBB Community Forums

Full Version: jSnippets 1.0 (jQuery & JS Manager)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Introducing jSnippets for MyBB 1.6

[Image: jsnippets_banner.jpg]

The Audentio Design team is proud to release the revolutionary new javascript management plugin for MyBB. This plugin will allow a user to not only manage all the javascript on their forum in one place, but also download advanced functions directly from the control panel.

Javascript is becoming an even more prominent aspect of web design than ever before and it is the third main language of the three front end client side languages. Therefore, the Audentio Design team felt that it deserved its own management area in the control panel.

There is a theme manager for images and CSS and a template manager for HTML. The third aspect is something that has not been included in any forum software and we concluded that by today's standards, it should be considered a more important part.

This plugin is a complete version, but there will be many more features added in the future. Some include more advanced ways to manage file sizes, load times, and other forms of optimization. This plugin will work with any javascript, including libraries such as jQuery and Mootools.

Prototype has not been written out in this plugin, it is still very much the main core library in MyBB. We were going to completely remove Prototype from MyBB, but with 2.0 on the way, we felt that it might be more work than is necessary. We wanted a tool that could be used right out of the box with any MyBB installation.

Currently, we are looking for some script developers and programmers to help us in creating new, high quality snippets. Please contact us if you are interested in joining our team and helping us with this revolutionary new product.

We highly recommend taking any javascript in your themes, and storing them in this system. In future versions, we will be offering tools to allow the plugins to work together and alert you of any inconsistencies or updates in code.

Note: If you currently plan to use this plugin, we have enabled jQuery by default. Therefore, if any of your themes currently have jQuery embedded in the headerinclude template, please comment it out or delete it.

Please see the readme.txt file for installation instructions and other license information.

A big thanks to Jorge Lainfiesta for massive amounts of help and ideas, and to Jitendra Maharaj for the impressive skillful development of the plugin.


Download

@ Audentio Design



Download

From the mods site


Merry Christmas, happy holidays, and enjoy!
The Audentio Design Team
approved and edited with link to the mods site

Thank you audentio for your innovative contribution. Like to see mybb on top with unique features.

can you mention which js-scripts & codes are to be commented in default mybb headerinlcude file?
you do not really need to comment anything by default

all you need to do is upload and activate

all the need js and jQuery library is loaded by default ( can be removed)
i just uploaded as mentioned and activated, but after the default collapsing stopped working.
Can you link me to the site? You can PM if you'd like.
I had seen that fancy collapse code if conflicting.

 
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);

The collapse tabs are working when the fancy collapse is deactivated. Can i know how to change the code with other variable inorder to not conflict. Using the noconflict jquery code is of no use.
replace the default smooth scroll top snippet with this code
//** Scrolling HTML Bookmarks script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com/ (April 11th, 09')
//** Updated Nov 10th, 09'- Fixed anchor jumping issue in IE7

var bookmarkscroll={
	setting: {duration:1000, yoffset:0}, //{duration_of_scroll_milliseconds, offset_from_target_element_to_rest}
	topkeyword: '#top', //keyword used in your anchors and scrollTo() to cause script to scroll page to very top

	scrollTo:function(dest, options, hash){
		var $=jQuery, options=options || {}
		var $dest=(typeof dest=="string" && dest.length>0)? (dest==this.topkeyword? 0 : $('#'+dest)) : (dest)? $(dest) : [] //get element based on id, topkeyword, or dom ref
		if ($dest===0 || $dest.length==1 && (!options.autorun || options.autorun && Math.abs($dest.offset().top+(options.yoffset||this.setting.yoffset)-$(window).scrollTop())>5)){
			this.$body.animate({scrollTop: ($dest===0)? 0 : $dest.offset().top+(options.yoffset||this.setting.yoffset)}, (options.duration||this.setting.duration), function(){
				if ($dest!==0 && hash)
					location.hash=hash
			})
		}
	},

	urlparamselect:function(){
		var param=window.location.search.match(/scrollto=[\w\-_,]+/i) //search for scrollto=divid
		return (param)? param[0].split('=')[1] : null
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=bookmarkscroll
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			var urlselectid=mainobj.urlparamselect() //get div of page.htm?scrollto=divid
			if (urlselectid) //if id defined
				setTimeout(function(){mainobj.scrollTo(document.getElementById(urlselectid) || $('a[name='+urlselectid+']:eq(0)').get(0), {autorun:true})}, 100)
			$('a[href^="#"]').each(function(){ //loop through links with "#" prefix
				var hashvalue=this.getAttribute('href').match(/#\w+$/i) //filter links at least 1 character following "#" prefix
				hashvalue=(hashvalue)? hashvalue[0].substring(1) : null //strip "#" from hashvalue
				if (this.hash.length>1){ //if hash value is more than just "#"
					var $bookmark=$('a[name='+this.hash.substr(1)+']:eq(0)')
					if ($bookmark.length==1 || this.hash==mainobj.topkeyword){ //if HTML anchor with given ID exists or href==topkeyword
						if ($bookmark.length==1 && !document.all) //non IE, or IE7+
							$bookmark.html('.').css({position:'absolute', fontSize:1, visibility:'hidden'})
						$(this).click(function(e){
							mainobj.scrollTo((this.hash==mainobj.topkeyword)? mainobj.topkeyword : $bookmark.get(0), {}, this.hash)
							e.preventDefault()
						})
					}
				}
			})
		})
	}
}

bookmarkscroll.init()

default smooth scroll to top snippet is not working
i would like to contribute my jquery plugin, javascript logout confirmation.
http://mods.mybb.com/view/javascript-log...nfirmation
we have done extensive testing with MyBB and a default installation of this and I can assure you that the expand/collapse is working by default with just installation and NO changes to templates

please give me a link to your board so that we may see the source

thanks
This is a great modification, Thanks to all Audentio team!
TheGodFather, thank you very much for your contribution. We will run some tests and get it added to the database. Please send us any information on that that you feel is necessary (name, email, etc.) so we can keep in contact with you.

danysalva, thank you very much!
Pages: 1 2 3 4