├── .bowerrc ├── .gitignore ├── .jshintrc ├── .travis.yml ├── Gruntfile.js ├── MIT-LICENSE.txt ├── README.md ├── bower.json ├── dist ├── themproject.bd.js ├── themproject.bd.map ├── themproject.bd.min.js ├── themproject.css ├── themproject.js ├── themproject.map ├── themproject.min.css ├── themproject.min.js ├── themproject_android_dark.css ├── themproject_android_dark.min.css ├── themproject_android_light.css ├── themproject_android_light.min.css ├── themproject_ios.css └── themproject_ios.min.css ├── doc-template ├── jsdoc.conf.json ├── publish.js ├── static │ ├── img │ │ ├── glyphicons-halflings-white.png │ │ ├── glyphicons-halflings.png │ │ ├── layouts │ │ │ ├── Blank.png │ │ │ ├── Header_Content.png │ │ │ ├── Listview.png │ │ │ ├── Swipe_Blank.png │ │ │ ├── Swipe_HeaderContent.png │ │ │ └── Tabbar.png │ │ ├── logo_small.png │ │ ├── styleguide.png │ │ ├── the-m-project-logo.png │ │ ├── try-addressbook.png │ │ └── try-kitchensink.png │ ├── scripts │ │ ├── URI.js │ │ ├── bootstrap-tab.js │ │ ├── jquery.localScroll.js │ │ ├── jquery.min.js │ │ ├── jquery.scrollTo.js │ │ ├── prettify │ │ │ ├── Apache-License-2.0.txt │ │ │ ├── jquery.min.js │ │ │ ├── lang-css.js │ │ │ └── prettify.js │ │ ├── search.js │ │ ├── shBrushJScript.js │ │ ├── shCore.js │ │ ├── toc.js │ │ └── toggle-menu.js │ └── styles │ │ ├── darkstrap.css │ │ ├── prettify-tomorrow.css │ │ ├── shCore.css │ │ ├── shCoreDefault.css │ │ ├── shThemeDefault.css │ │ ├── site..css │ │ ├── site.amelia.css │ │ ├── site.cerulean.css │ │ ├── site.cosmo.css │ │ ├── site.cyborg.css │ │ ├── site.darkstrap.css │ │ ├── site.flatly.css │ │ ├── site.journal.css │ │ ├── site.mway.css │ │ ├── site.readable.css │ │ ├── site.simplex.css │ │ ├── site.slate.css │ │ ├── site.spacelab.css │ │ ├── site.spruce.css │ │ ├── site.superhero.css │ │ ├── site.united.css │ │ ├── sunlight.dark.css │ │ └── sunlight.default.css └── tmpl │ ├── container.tmpl │ ├── details.tmpl │ ├── example.tmpl │ ├── examples.tmpl │ ├── exceptions.tmpl │ ├── fires.tmpl │ ├── layout.tmpl │ ├── mainpage.tmpl │ ├── members.tmpl │ ├── method.tmpl │ ├── params.tmpl │ ├── properties.tmpl │ ├── returns.tmpl │ ├── sections.tmpl │ ├── source.tmpl │ ├── tutorial.tmpl │ └── type.tmpl ├── init-repo.bat ├── init-repo.sh ├── package.json ├── resources └── sass │ ├── _master.scss │ ├── bootstrap.scss │ ├── layouts │ ├── _bottom-bar-layout.scss │ ├── _header-layout.scss │ ├── _split-layout.scss │ ├── _swipe-layout.scss │ ├── _switch-animations.scss │ ├── _switch-header-content-layout.scss │ ├── _switch-layout.scss │ └── _tab-layout.scss │ ├── themes │ ├── _extends.scss │ ├── android_dark │ │ ├── _buttongroup.scss │ │ └── _variables.scss │ ├── android_light │ │ ├── _buttongroup.scss │ │ ├── _selectionlist.scss │ │ ├── _tab-layout.scss │ │ └── _variables.scss │ ├── default │ │ ├── _base.scss │ │ ├── _button.scss │ │ ├── _buttongroup.scss │ │ ├── _checkboxlist.scss │ │ ├── _debug.scss │ │ ├── _elements.scss │ │ ├── _header.scss │ │ ├── _list.scss │ │ ├── _loader.scss │ │ ├── _menu.scss │ │ ├── _modal.scss │ │ ├── _movable.scss │ │ ├── _radiolist.scss │ │ ├── _selectionlist.scss │ │ ├── _text.scss │ │ ├── _textfield.scss │ │ ├── _toast.scss │ │ ├── _toggleswitch.scss │ │ ├── _toolbar.scss │ │ └── _variables.scss │ ├── ios │ │ ├── _base.scss │ │ ├── _buttongroup.scss │ │ ├── _checkboxlist.scss │ │ ├── _radiolist.scss │ │ ├── _tab-layout.scss │ │ ├── _toggleswitch.scss │ │ └── _variables.scss │ └── mixins.scss │ ├── themproject.scss │ ├── themproject_android_dark.scss │ ├── themproject_android_light.scss │ └── themproject_ios.scss ├── scripts └── pre-commit ├── server ├── README.md ├── bikini_live.js ├── mongodb_rest.js ├── package.json ├── public │ └── index.html ├── racer.js ├── server.js ├── share.js └── sockets.js ├── src ├── _core.js ├── _ui.js ├── connection │ ├── request.js │ └── request_manager.js ├── core │ ├── application.js │ ├── config.js │ ├── const.js │ ├── controller.js │ ├── environment.js │ ├── logger.js │ ├── m.js │ ├── object.js │ ├── router.js │ └── viewmanager.js ├── data │ ├── collection.js │ ├── data_selector.js │ ├── entity.js │ ├── field.js │ ├── model.js │ ├── security.js │ ├── sql_selector.js │ └── stores │ │ ├── bikini_store.js │ │ ├── local_storage.js │ │ ├── store.js │ │ └── web_sql.js ├── interfaces │ ├── activestate.js │ ├── addcssclass.js │ ├── interface.js │ └── viewenablestate.js ├── templates.js ├── templates │ └── default │ │ ├── accordion.ejs │ │ ├── accordionitem.ejs │ │ ├── button.ejs │ │ ├── buttongroup.ejs │ │ ├── checkboxlist.ejs │ │ ├── checkboxoption.ejs │ │ ├── debug.ejs │ │ ├── dialog.ejs │ │ ├── image.ejs │ │ ├── label.ejs │ │ ├── list.ejs │ │ ├── listitem.ejs │ │ ├── listitemlinked.ejs │ │ ├── loader.ejs │ │ ├── menu.ejs │ │ ├── modal.ejs │ │ ├── model.ejs │ │ ├── movable.ejs │ │ ├── radiolist.ejs │ │ ├── radiooption.ejs │ │ ├── searchfield.ejs │ │ ├── select.ejs │ │ ├── slider.ejs │ │ ├── tabbarbuttongroup.ejs │ │ ├── text.ejs │ │ ├── textarea.ejs │ │ ├── textfield.ejs │ │ ├── toast.ejs │ │ ├── toggle.ejs │ │ ├── toggleswitch.ejs │ │ ├── toolbar.ejs │ │ └── view.ejs ├── themproject.bd.js ├── themproject.js ├── ui │ ├── layouts │ │ ├── bottom-bar-layout.js │ │ ├── header-layout.js │ │ ├── layout.js │ │ ├── split-layout.js │ │ ├── swipe-layout.js │ │ ├── switch-header-content.js │ │ ├── switch-layout.js │ │ ├── switch-menu-header-content.js │ │ └── tab-layout.js │ ├── pagetransitions.js │ ├── themes.js │ ├── themevars.js │ └── views │ │ ├── button.js │ │ ├── buttongroup.js │ │ ├── checkboxlist.js │ │ ├── debug.js │ │ ├── dialog.js │ │ ├── image.js │ │ ├── list.js │ │ ├── listitem.js │ │ ├── loader.js │ │ ├── menu.js │ │ ├── modal.js │ │ ├── movable.js │ │ ├── radiolist.js │ │ ├── searchfield.js │ │ ├── select.js │ │ ├── selectionlist.js │ │ ├── slider.js │ │ ├── tab.js │ │ ├── tabbarbuttongroup.js │ │ ├── template_manager.js │ │ ├── text.js │ │ ├── textarea.js │ │ ├── textfield.js │ │ ├── toast.js │ │ ├── toggle.js │ │ ├── toggleswitch.js │ │ ├── toolbar.js │ │ └── view.js └── utility │ ├── animation.js │ ├── base64.js │ ├── cypher.js │ ├── date.js │ ├── i18n.js │ ├── i18n_item.js │ ├── objectid.js │ ├── sha256.js │ └── uuid.js ├── tasks ├── compileTemplates.js ├── extractSassVars.js ├── rewriteMarkdownFiles.js └── tpl │ ├── templates.txt │ └── themevars.txt ├── test ├── core │ ├── test.controller.js │ ├── test.i18n.js │ ├── test.i18n_item.js │ ├── test.m.js │ ├── test.object.js │ ├── test.router.js │ ├── test.scope.js │ └── test.viewmanager.js ├── css │ └── mocha.css ├── data │ ├── test.bikini.js │ ├── test.collection.js │ ├── test.entity.js │ ├── test.field.js │ ├── test.local_storage.js │ ├── test.model.js │ └── test.websql.js ├── i18n │ ├── de.js │ └── en.js ├── interfaces │ ├── test.activestate.js │ ├── test.addcssclass.js │ └── test.interface.js ├── js │ ├── bridge.js │ ├── chai.js │ └── mocha.js ├── test.html ├── test.js └── ui │ ├── binding │ ├── test.bindings.js │ └── test.kitchensink.js │ ├── events │ ├── test.events.js │ ├── test.events.swipe.js │ └── test.events.tap.js │ ├── test.pagetransitions.js │ ├── test.themevars.js │ └── views │ ├── test.button.js │ ├── test.buttongroup.js │ ├── test.image.js │ ├── test.list.js │ ├── test.loader.js │ ├── test.menu.js │ ├── test.modal.js │ ├── test.radiolist.js │ ├── test.searchfield.js │ ├── test.template.js │ ├── test.template_manager.js │ ├── test.text.js │ ├── test.textfield.js │ ├── test.toast.js │ ├── test.toggleswitch.js │ ├── test.toolbar.js │ ├── test.view.computedvalue.js │ └── test.view.js └── thanks_to.md /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components" 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components 3 | .sass-cache 4 | .tmp 5 | .idea 6 | .DS_STORE 7 | npm-debug.log 8 | doc -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": false, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "immed": true, 10 | "indent": 4, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": false, 18 | "strict": false, 19 | "trailing": true, 20 | "smarttabs": true, 21 | "jquery": true, 22 | "globals": { 23 | "M": true, 24 | "Backbone": false, 25 | "_": false, 26 | "moment": false, 27 | "io": false, 28 | "YES": true, 29 | "NO": true, 30 | "Modernizr": false, 31 | "Hammer": false, 32 | "FastClick": false, 33 | "enquire": false 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | - '0.8' 5 | before_script: 6 | - npm install -g grunt-cli 7 | - gem install compass 8 | - sh init-repo.sh -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 M-Way Solutions GmbH 2 | http://www.mwaysolutions.com/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in the 6 | Software without restriction, including without limitation the rights to use, copy, 7 | modify, merge, publish, distribute, sublicense, and/or sell copies of the 8 | Software, and to permit persons to whom the Software is furnished to do so, subject 9 | to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or 12 | substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 17 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "The-M-Project", 3 | "version": "2.0.0-beta3", 4 | "main": [ 5 | "./dist/*.js", 6 | "./dist/*.css" 7 | ], 8 | "ignore": [ 9 | "**/.*", 10 | "node_modules", 11 | "bower_components", 12 | "src", 13 | "test", 14 | "scripts", 15 | "resources", 16 | "sample", 17 | "server", 18 | "utils", 19 | "tasks", 20 | "doc-template", 21 | "Gruntfile.js", 22 | "*.sh", 23 | "*.md", 24 | "*.json", 25 | "*.txt", 26 | "*.bat" 27 | ], 28 | "dependencies": { 29 | "backbone": "~1.1.0", 30 | "underscore": "~1.5.2", 31 | "jquery": "~2.0.3", 32 | "backbone.stickit": "~0.6.3", 33 | "tmpl": "~0.1.6", 34 | "socket.io-client": "~0.9.16", 35 | "modernizr": "~2.6.2", 36 | "momentjs": "~2.4.0", 37 | "hammerjs": "~1.0.5", 38 | "detectizr": "~1.4.5", 39 | "font-awesome": "~4.0.3", 40 | "shake.js": "~1.1.0", 41 | "fastclick": "~0.6.10", 42 | "bootstrap-sass": "~3.0.2", 43 | "enquire": "~2.1.0" 44 | }, 45 | "devDependencies": { 46 | "mocha": "~1.13.0", 47 | "chai": "~1.8.1" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /doc-template/jsdoc.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags" : { 3 | "allowUnknownTags" : true 4 | }, 5 | "plugins" : ["plugins/markdown"], 6 | "templates" : { 7 | "cleverLinks" : false, 8 | "monospaceLinks" : false, 9 | "default" : { 10 | "outputSourceFiles" : true 11 | }, 12 | "systemName" : "The-M-Project Absinthe", 13 | "footer" : "", 14 | "copyright" : "Copyright © 2013 M-Way Solutions GmbH", 15 | "navType" : "vertical", 16 | "theme" : "mway", 17 | "linenums" : true, 18 | "collapseSymbols" : false, 19 | "inverseNav" : true 20 | }, 21 | "markdown" : { 22 | "parser" : "gfm", 23 | "hardwrap" : true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /doc-template/static/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /doc-template/static/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /doc-template/static/img/layouts/Blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/layouts/Blank.png -------------------------------------------------------------------------------- /doc-template/static/img/layouts/Header_Content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/layouts/Header_Content.png -------------------------------------------------------------------------------- /doc-template/static/img/layouts/Listview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/layouts/Listview.png -------------------------------------------------------------------------------- /doc-template/static/img/layouts/Swipe_Blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/layouts/Swipe_Blank.png -------------------------------------------------------------------------------- /doc-template/static/img/layouts/Swipe_HeaderContent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/layouts/Swipe_HeaderContent.png -------------------------------------------------------------------------------- /doc-template/static/img/layouts/Tabbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/layouts/Tabbar.png -------------------------------------------------------------------------------- /doc-template/static/img/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/logo_small.png -------------------------------------------------------------------------------- /doc-template/static/img/styleguide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/styleguide.png -------------------------------------------------------------------------------- /doc-template/static/img/the-m-project-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/the-m-project-logo.png -------------------------------------------------------------------------------- /doc-template/static/img/try-addressbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/try-addressbook.png -------------------------------------------------------------------------------- /doc-template/static/img/try-kitchensink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mway-io/The-M-Project/96ee0ef889a79c27d8e3793d1e9a6599a159f909/doc-template/static/img/try-kitchensink.png -------------------------------------------------------------------------------- /doc-template/static/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([ 2 | ["pln", /^[\t\n\f\r ]+/, null, " \t\r\n "] 3 | ], [ 4 | ["str", /^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/, null], 5 | ["str", /^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/, null], 6 | ["lang-css-str", /^url\(([^"')]*)\)/i], 7 | ["kwd", /^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i, null], 8 | ["lang-css-kw", /^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i], 9 | ["com", /^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//], 10 | ["com", /^(?:<\!--|--\>)/], 11 | ["lit", /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i], 12 | ["lit", /^#[\da-f]{3,6}/i], 13 | ["pln", /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i], 14 | ["pun", /^[^\s\w"']+/] 15 | ]), ["css"]); 16 | PR.registerLangHandler(PR.createSimpleLexer([], [ 17 | ["kwd", /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i] 18 | ]), ["css-kw"]); 19 | PR.registerLangHandler(PR.createSimpleLexer([], [ 20 | ["str", /^[^"')]+/] 21 | ]), ["css-str"]); -------------------------------------------------------------------------------- /doc-template/static/scripts/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'break case catch continue ' + 25 | 'default delete do else false ' + 26 | 'for function if in instanceof ' + 27 | 'new null return super switch ' + 28 | 'this throw true try typeof var while with' 29 | ; 30 | 31 | var r = SyntaxHighlighter.regexLib; 32 | 33 | this.regexList = [ 34 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 35 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 36 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments 37 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 38 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 40 | ]; 41 | 42 | this.forHtmlScript(r.scriptScriptTags); 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['js', 'jscript', 'javascript']; 47 | 48 | SyntaxHighlighter.brushes.JScript = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | -------------------------------------------------------------------------------- /doc-template/static/scripts/toc.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $.fn.toc = function(options) { 3 | var self = this; 4 | var opts = $.extend({}, jQuery.fn.toc.defaults, options); 5 | 6 | var container = $(opts.container); 7 | var headings = $(opts.selectors, container); 8 | var headingOffsets = []; 9 | var activeClassName = opts.prefix+'-active'; 10 | 11 | var scrollTo = function(e) { 12 | if (opts.smoothScrolling) { 13 | e.preventDefault(); 14 | var elScrollTo = $(e.target).attr('href'); 15 | var $el = $(elScrollTo); 16 | 17 | $('body,html').animate({ scrollTop: $el.offset().top }, 400, 'swing', function() { 18 | location.hash = elScrollTo; 19 | }); 20 | } 21 | $('li', self).removeClass(activeClassName); 22 | $(e.target).parent().addClass(activeClassName); 23 | }; 24 | 25 | //highlight on scroll 26 | var timeout; 27 | var highlightOnScroll = function(e) { 28 | if (timeout) { 29 | clearTimeout(timeout); 30 | } 31 | timeout = setTimeout(function() { 32 | var top = $(window).scrollTop(), 33 | highlighted; 34 | for (var i = 0, c = headingOffsets.length; i < c; i++) { 35 | if (headingOffsets[i] >= top) { 36 | $('li', self).removeClass(activeClassName); 37 | highlighted = $('li:eq('+(i-1)+')', self).addClass(activeClassName); 38 | opts.onHighlight(highlighted); 39 | break; 40 | } 41 | } 42 | }, 50); 43 | }; 44 | if (opts.highlightOnScroll) { 45 | $(window).bind('scroll', highlightOnScroll); 46 | highlightOnScroll(); 47 | } 48 | 49 | return this.each(function() { 50 | //build TOC 51 | var el = $(this); 52 | var ul = $('