Sha256: 1036124e3a7e1c52f75b832731404678b0dbaad12869c697f97f1074eaab3eda

Contents?: true

Size: 1.91 KB

Versions: 31

Compression:

Stored size: 1.91 KB

Contents

/* */ 
"format cjs";
webshims.ready('jquery', function($){
	// Set up the 'play' buttons for each runnable code example.
	//todo need to write a prism plugin
	/*
	 $(function(){
	 
	 $('.runnable').each(function(){
	 var code = this;
	 var button = '<div class="run" title="Run"></div>';
	 $(button).insertBefore(code).bind('click', function(){
	 eval($(code).text());
	 });
	 });
	 });
	 */
	// highlight the active menu. Modified from http://expressjs.com/app.js
	$(function(){
		var prev;
		var n = 0;
		
		var headings = $('h2[id],h3[id]').map(function(i, el){
			return {
				top: $(el).offset().top - 10,
				id: el.id
			};
		});
		
		function closest(){
			var h;
			var top = $(window).scrollTop();
			var i = headings.length;
			while (i--) {
				h = headings[i];
				if (top >= h.top) {
					return h;
				}
			}
		}
		var _onScroll = (function(){
			var timer;
			var fn = function(){
				var h = closest();
				if (!h) {
					return;
				}
				
				if (prev) {
					prev.removeClass('active');
				}
				
				var a = $('a[href="#' + h.id + '"]');
				a.addClass('active');
				
				prev = a;
			};
			return function(){
				clearTimeout(timer);
				timer = setTimeout(fn, 9);
			};
		})();
		
		$(document).on('scroll', _onScroll);
		_onScroll();
	});

	
	
	$(function(){
		var langs = webshims.validityMessages.availableLangs.concat(['de', 'en', 'en-AU', 'en-GB', 'en-US']).sort();
		
		langs.unshift('');
		$('select.active-lang').each(function(){
			var select = $(this);
			var options = langs.map(function(lang){
				return '<option>'+ lang +'</option>';
			});
			var onLangChange = function(){
				select.val(this.__activeName ||  webshims.activeLang());
			};
			
			select
				.html(options)
				.on('change', function(){
					var value = select.val();
					if(value){
						webshims.activeLang(value);
					}
				})
			;
			$(webshims.validityMessages)
				.on('change', onLangChange)
				.each(onLangChange)
			;
		});
	});
});
	

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
sequenceserver-3.1.3 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-3.1.2 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-3.1.1 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-3.1.0 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-3.0.1 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-3.0 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.2.0 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.1.0 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc8 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc7 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc6 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc5 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc4 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc3 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc2 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.rc1 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.beta4 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.beta3 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js
sequenceserver-2.0.0.beta1 public/vendor/npm/webshim@1.15.8/demos/demo-js/src/behavior.js