├── .github └── workflows │ └── build.yml ├── .gitignore ├── README.md ├── SUMMARY.md ├── bake-index.js ├── book └── gitbook │ ├── fonts │ └── fontawesome │ │ └── fontawesome-webfont.woff │ ├── gitbook-plugin-fontsettings │ └── fontsettings.js │ ├── gitbook-plugin-lunr │ ├── lunr.js │ ├── lunr.min.js │ └── search-lunr.js │ ├── gitbook-plugin-search │ ├── search-engine.js │ └── search.js │ ├── gitbook-plugin-sharing │ └── buttons.js │ ├── gitbook.js │ ├── style.css │ ├── theme.js │ └── website.css ├── build.sh ├── manifest.scm ├── package-lock.json ├── package.json ├── pages ├── README.md ├── downloading_files_with_wget,_curl_and_ftp │ └── README.md ├── sun_grid_engine_for_beginners │ ├── README.md │ ├── faq.md │ ├── how_to_run_array_jobs.md │ ├── how_to_submit_a_job_using_qsub.md │ ├── how_to_use_interactive_sessions_with_qrsh.md │ ├── monitoring_cluster_usage_and_troubleshooting.md │ ├── parallel_environments.md │ ├── quickstart_and_basics.md │ └── resources_and_queues.md └── unix_for_beginners │ ├── README.md │ ├── basics.md │ ├── compressing_and_decompressing_files.md │ ├── connecting_to_a_remote_server.md │ ├── editing_and_manipulating_files.md │ ├── file_management_and_directories.md │ ├── more_on_unix.md │ └── shell_scripting_bash.md ├── template.html └── template.json /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | on: 3 | push: 4 | jobs: 5 | build: 6 | name: compile book from markdown 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v3 11 | - name: Setup node 12 | uses: actions/setup-node@v3 13 | with: 14 | node-version: 16.13.x 15 | cache: npm 16 | - name: Install pandoc 17 | run: | 18 | curl -fLo /tmp/pandoc-2.10.1-1-amd64.deb https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb 19 | sudo dpkg -i /tmp/pandoc-2.10.1-1-amd64.deb 20 | - name: Install npm packages 21 | run: npm ci 22 | - name: Build website 23 | run: bash build.sh 24 | - name: Upload artifact 25 | uses: actions/upload-pages-artifact@v1 26 | with: 27 | name: 'github-pages' 28 | path: 'book' 29 | deploy: 30 | needs: build 31 | 32 | # Grant GITHUB_TOKEN the permissions required to make a Pages deployment 33 | permissions: 34 | pages: write # to deploy to Pages 35 | id-token: write # to verify the deployment originates from an appropriate source 36 | 37 | # Deploy to the github-pages environment 38 | environment: 39 | name: github-pages 40 | url: ${{ steps.deployment.outputs.page_url }} 41 | 42 | # Specify runner + deployment step 43 | runs-on: ubuntu-latest 44 | steps: 45 | - name: Deploy to GitHub Pages 46 | id: deployment 47 | uses: actions/deploy-pages@v1 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | book/search_index.json 2 | book/**.html 3 | book/downloading_files_with_wget,_curl_and_ftp/ 4 | book/sun_grid_engine_for_beginners/ 5 | book/unix_for_beginners/ 6 | tmp/ 7 | node_modules/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | 3 | ## Introduction to Unix and Grid Engine for beginners 4 | 5 | This is a guide on using Unix-like systems and the Grid Engine cluster 6 | environment. 7 | 8 | The first chapter will introduce basic usage for Unix-like 9 | systems. The second chapter will explore the Grid Engine environment 10 | and show how to use the queuing system from users perspective. 11 | 12 | ### What will you get out of this ? 13 | 14 | After reading, you will: 15 | 16 | * be able to use the command line interface to navigate the file system 17 | * use the command line to interrogate files 18 | * understand and write basic shell scripts 19 | * understand Grid Engine and queueing system 20 | * be able to submit jobs to a Grid Engine cluster and troubleshoot 21 | 22 | ### Contribute to the development 23 | 24 | You can contribute to the development of this guide using GitHub 25 | features such as pull-requests and issue creation. 26 | 27 | 28 | ### Build the book 29 | 30 | This book is compiled with pandoc. 31 | 32 | Run `guix environment -m manifest.scm` to enter a suitable environment 33 | to hack on this book. Then run `npm ci` to install the lunr 34 | JavaScript library for the search index. 35 | 36 | 37 | ### How to update the book website 38 | 39 | The book and its website are automatically updated on a successful 40 | push to the `master` branch. 41 | 42 | 43 | ### Acknowledgements 44 | 45 | Initially created by Altuna Akalin. Some of the material is based on 46 | Martin Siegert's documentation of the Grid Engine cluster. 47 | -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Unix for beginners ](unix_for_beginners/README.md) 4 | * [Basics](unix_for_beginners/basics.md) 5 | * [File management and directories](unix_for_beginners/file_management_and_directories.md) 6 | * [Editing, viewing and concatenating text files](unix_for_beginners/editing_and_manipulating_files.md) 7 | * [Compressing and decompressing files](unix_for_beginners/compressing_and_decompressing_files.md) 8 | * [Connecting to a remote server with SSH](unix_for_beginners/connecting_to_a_remote_server.md) 9 | * [Downloading files with wget, curl and ftp](downloading_files_with_wget,_curl_and_ftp/README.md) 10 | * [Simple shell scripting (bash)](unix_for_beginners/shell_scripting_bash.md) 11 | * [More on Unix...](unix_for_beginners/more_on_unix.md) 12 | * [Grid Engine for beginners](sun_grid_engine_for_beginners/README.md) 13 | * [Quickstart and basics](sun_grid_engine_for_beginners/quickstart_and_basics.md) 14 | * [Resources and queues ](sun_grid_engine_for_beginners/resources_and_queues.md) 15 | * [How to submit a job using qsub](sun_grid_engine_for_beginners/how_to_submit_a_job_using_qsub.md) 16 | * [How to use interactive sessions with qrsh](sun_grid_engine_for_beginners/how_to_use_interactive_sessions_with_qrsh.md) 17 | * [How to run array jobs](sun_grid_engine_for_beginners/how_to_run_array_jobs.md) 18 | * [Parallel environments](sun_grid_engine_for_beginners/parallel_environments.md) 19 | * [Monitoring cluster usage and troubleshooting](sun_grid_engine_for_beginners/monitoring_cluster_usage_and_troubleshooting.md) 20 | * [FAQ](sun_grid_engine_for_beginners/faq.md) 21 | 22 | -------------------------------------------------------------------------------- /bake-index.js: -------------------------------------------------------------------------------- 1 | var lunr = require('lunr'), 2 | stdin = process.stdin, 3 | stdout = process.stdout, 4 | buffer = []; 5 | 6 | stdin.resume(); 7 | stdin.setEncoding('utf8'); 8 | 9 | stdin.on('data', function (data) { 10 | buffer.push(data); 11 | }); 12 | 13 | stdin.on('end', function () { 14 | var documents = JSON.parse(buffer.join('')); 15 | 16 | var idx = lunr(function () { 17 | this.ref('url'); 18 | this.field('title'); 19 | this.field('keywords'); 20 | this.field('body'); 21 | 22 | documents.forEach(function (doc) { 23 | this.add(doc); 24 | }, this); 25 | }); 26 | 27 | var index = { 28 | "index": idx, 29 | "store": {} 30 | }; 31 | 32 | documents.forEach(function (doc) { 33 | index.store[doc.url] = doc; 34 | }); 35 | stdout.write(JSON.stringify(index)); 36 | }); 37 | -------------------------------------------------------------------------------- /book/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/intro2UnixandSGE/b9fd237b7ebda0b8e678e72fe441708d8fca305a/book/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /book/gitbook/gitbook-plugin-fontsettings/fontsettings.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | // Configuration 3 | var MAX_SIZE = 4, 4 | MIN_SIZE = 0, 5 | BUTTON_ID; 6 | 7 | // Current fontsettings state 8 | var fontState; 9 | 10 | // Default themes 11 | var THEMES = [ 12 | { 13 | config: 'white', 14 | text: 'White', 15 | id: 0 16 | }, 17 | { 18 | config: 'sepia', 19 | text: 'Sepia', 20 | id: 1 21 | }, 22 | { 23 | config: 'night', 24 | text: 'Night', 25 | id: 2 26 | } 27 | ]; 28 | 29 | // Default font families 30 | var FAMILIES = [ 31 | { 32 | config: 'serif', 33 | text: 'Serif', 34 | id: 0 35 | }, 36 | { 37 | config: 'sans', 38 | text: 'Sans', 39 | id: 1 40 | } 41 | ]; 42 | 43 | // Return configured themes 44 | function getThemes() { 45 | return THEMES; 46 | } 47 | 48 | // Modify configured themes 49 | function setThemes(themes) { 50 | THEMES = themes; 51 | updateButtons(); 52 | } 53 | 54 | // Return configured font families 55 | function getFamilies() { 56 | return FAMILIES; 57 | } 58 | 59 | // Modify configured font families 60 | function setFamilies(families) { 61 | FAMILIES = families; 62 | updateButtons(); 63 | } 64 | 65 | // Save current font settings 66 | function saveFontSettings() { 67 | gitbook.storage.set('fontState', fontState); 68 | update(); 69 | } 70 | 71 | // Increase font size 72 | function enlargeFontSize(e) { 73 | e.preventDefault(); 74 | if (fontState.size >= MAX_SIZE) return; 75 | 76 | fontState.size++; 77 | saveFontSettings(); 78 | } 79 | 80 | // Decrease font size 81 | function reduceFontSize(e) { 82 | e.preventDefault(); 83 | if (fontState.size <= MIN_SIZE) return; 84 | 85 | fontState.size--; 86 | saveFontSettings(); 87 | } 88 | 89 | // Change font family 90 | function changeFontFamily(configName, e) { 91 | if (e && e instanceof Event) { 92 | e.preventDefault(); 93 | } 94 | 95 | var familyId = getFontFamilyId(configName); 96 | fontState.family = familyId; 97 | saveFontSettings(); 98 | } 99 | 100 | // Change type of color theme 101 | function changeColorTheme(configName, e) { 102 | if (e && e instanceof Event) { 103 | e.preventDefault(); 104 | } 105 | 106 | var $book = gitbook.state.$book; 107 | 108 | // Remove currently applied color theme 109 | if (fontState.theme !== 0) 110 | $book.removeClass('color-theme-'+fontState.theme); 111 | 112 | // Set new color theme 113 | var themeId = getThemeId(configName); 114 | fontState.theme = themeId; 115 | if (fontState.theme !== 0) 116 | $book.addClass('color-theme-'+fontState.theme); 117 | 118 | saveFontSettings(); 119 | } 120 | 121 | // Return the correct id for a font-family config key 122 | // Default to first font-family 123 | function getFontFamilyId(configName) { 124 | // Search for plugin configured font family 125 | var configFamily = $.grep(FAMILIES, function(family) { 126 | return family.config == configName; 127 | })[0]; 128 | // Fallback to default font family 129 | return (!!configFamily)? configFamily.id : 0; 130 | } 131 | 132 | // Return the correct id for a theme config key 133 | // Default to first theme 134 | function getThemeId(configName) { 135 | // Search for plugin configured theme 136 | var configTheme = $.grep(THEMES, function(theme) { 137 | return theme.config == configName; 138 | })[0]; 139 | // Fallback to default theme 140 | return (!!configTheme)? configTheme.id : 0; 141 | } 142 | 143 | function update() { 144 | var $book = gitbook.state.$book; 145 | 146 | $('.font-settings .font-family-list li').removeClass('active'); 147 | $('.font-settings .font-family-list li:nth-child('+(fontState.family+1)+')').addClass('active'); 148 | 149 | $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); 150 | $book.addClass('font-size-'+fontState.size); 151 | $book.addClass('font-family-'+fontState.family); 152 | 153 | if(fontState.theme !== 0) { 154 | $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); 155 | $book.addClass('color-theme-'+fontState.theme); 156 | } 157 | } 158 | 159 | function init(config) { 160 | // Search for plugin configured font family 161 | var configFamily = getFontFamilyId(config.family), 162 | configTheme = getThemeId(config.theme); 163 | 164 | // Instantiate font state object 165 | fontState = gitbook.storage.get('fontState', { 166 | size: config.size || 2, 167 | family: configFamily, 168 | theme: configTheme 169 | }); 170 | 171 | update(); 172 | } 173 | 174 | function updateButtons() { 175 | // Remove existing fontsettings buttons 176 | if (!!BUTTON_ID) { 177 | gitbook.toolbar.removeButton(BUTTON_ID); 178 | } 179 | 180 | // Create buttons in toolbar 181 | BUTTON_ID = gitbook.toolbar.createButton({ 182 | icon: 'fa fa-font', 183 | label: 'Font Settings', 184 | className: 'font-settings', 185 | dropdown: [ 186 | [ 187 | { 188 | text: 'A', 189 | className: 'font-reduce', 190 | onClick: reduceFontSize 191 | }, 192 | { 193 | text: 'A', 194 | className: 'font-enlarge', 195 | onClick: enlargeFontSize 196 | } 197 | ], 198 | $.map(FAMILIES, function(family) { 199 | family.onClick = function(e) { 200 | return changeFontFamily(family.config, e); 201 | }; 202 | 203 | return family; 204 | }), 205 | $.map(THEMES, function(theme) { 206 | theme.onClick = function(e) { 207 | return changeColorTheme(theme.config, e); 208 | }; 209 | 210 | return theme; 211 | }) 212 | ] 213 | }); 214 | } 215 | 216 | // Init configuration at start 217 | gitbook.events.bind('start', function(e, config) { 218 | var opts = config.fontsettings; 219 | 220 | // Generate buttons at start 221 | updateButtons(); 222 | 223 | // Init current settings 224 | init(opts); 225 | }); 226 | 227 | // Expose API 228 | gitbook.fontsettings = { 229 | enlargeFontSize: enlargeFontSize, 230 | reduceFontSize: reduceFontSize, 231 | setTheme: changeColorTheme, 232 | setFamily: changeFontFamily, 233 | getThemes: getThemes, 234 | setThemes: setThemes, 235 | getFamilies: getFamilies, 236 | setFamilies: setFamilies 237 | }; 238 | }); 239 | 240 | 241 | -------------------------------------------------------------------------------- /book/gitbook/gitbook-plugin-lunr/lunr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 3 | * Copyright (C) 2015 Oliver Nightingale 4 | * MIT Licensed 5 | * @license 6 | */ 7 | 8 | ;(function(){ 9 | 10 | /** 11 | * Convenience function for instantiating a new lunr index and configuring it 12 | * with the default pipeline functions and the passed config function. 13 | * 14 | * When using this convenience function a new index will be created with the 15 | * following functions already in the pipeline: 16 | * 17 | * lunr.StopWordFilter - filters out any stop words before they enter the 18 | * index 19 | * 20 | * lunr.stemmer - stems the tokens before entering the index. 21 | * 22 | * Example: 23 | * 24 | * var idx = lunr(function () { 25 | * this.field('title', 10) 26 | * this.field('tags', 100) 27 | * this.field('body') 28 | * 29 | * this.ref('cid') 30 | * 31 | * this.pipeline.add(function () { 32 | * // some custom pipeline function 33 | * }) 34 | * 35 | * }) 36 | * 37 | * @param {Function} config A function that will be called with the new instance 38 | * of the lunr.Index as both its context and first parameter. It can be used to 39 | * customize the instance of new lunr.Index. 40 | * @namespace 41 | * @module 42 | * @returns {lunr.Index} 43 | * 44 | */ 45 | var lunr = function (config) { 46 | var idx = new lunr.Index 47 | 48 | idx.pipeline.add( 49 | lunr.trimmer, 50 | lunr.stopWordFilter, 51 | lunr.stemmer 52 | ) 53 | 54 | if (config) config.call(idx, idx) 55 | 56 | return idx 57 | } 58 | 59 | lunr.version = "0.5.12" 60 | /*! 61 | * lunr.utils 62 | * Copyright (C) 2015 Oliver Nightingale 63 | */ 64 | 65 | /** 66 | * A namespace containing utils for the rest of the lunr library 67 | */ 68 | lunr.utils = {} 69 | 70 | /** 71 | * Print a warning message to the console. 72 | * 73 | * @param {String} message The message to be printed. 74 | * @memberOf Utils 75 | */ 76 | lunr.utils.warn = (function (global) { 77 | return function (message) { 78 | if (global.console && console.warn) { 79 | console.warn(message) 80 | } 81 | } 82 | })(this) 83 | 84 | /*! 85 | * lunr.EventEmitter 86 | * Copyright (C) 2015 Oliver Nightingale 87 | */ 88 | 89 | /** 90 | * lunr.EventEmitter is an event emitter for lunr. It manages adding and removing event handlers and triggering events and their handlers. 91 | * 92 | * @constructor 93 | */ 94 | lunr.EventEmitter = function () { 95 | this.events = {} 96 | } 97 | 98 | /** 99 | * Binds a handler function to a specific event(s). 100 | * 101 | * Can bind a single function to many different events in one call. 102 | * 103 | * @param {String} [eventName] The name(s) of events to bind this function to. 104 | * @param {Function} fn The function to call when an event is fired. 105 | * @memberOf EventEmitter 106 | */ 107 | lunr.EventEmitter.prototype.addListener = function () { 108 | var args = Array.prototype.slice.call(arguments), 109 | fn = args.pop(), 110 | names = args 111 | 112 | if (typeof fn !== "function") throw new TypeError ("last argument must be a function") 113 | 114 | names.forEach(function (name) { 115 | if (!this.hasHandler(name)) this.events[name] = [] 116 | this.events[name].push(fn) 117 | }, this) 118 | } 119 | 120 | /** 121 | * Removes a handler function from a specific event. 122 | * 123 | * @param {String} eventName The name of the event to remove this function from. 124 | * @param {Function} fn The function to remove from an event. 125 | * @memberOf EventEmitter 126 | */ 127 | lunr.EventEmitter.prototype.removeListener = function (name, fn) { 128 | if (!this.hasHandler(name)) return 129 | 130 | var fnIndex = this.events[name].indexOf(fn) 131 | this.events[name].splice(fnIndex, 1) 132 | 133 | if (!this.events[name].length) delete this.events[name] 134 | } 135 | 136 | /** 137 | * Calls all functions bound to the given event. 138 | * 139 | * Additional data can be passed to the event handler as arguments to `emit` 140 | * after the event name. 141 | * 142 | * @param {String} eventName The name of the event to emit. 143 | * @memberOf EventEmitter 144 | */ 145 | lunr.EventEmitter.prototype.emit = function (name) { 146 | if (!this.hasHandler(name)) return 147 | 148 | var args = Array.prototype.slice.call(arguments, 1) 149 | 150 | this.events[name].forEach(function (fn) { 151 | fn.apply(undefined, args) 152 | }) 153 | } 154 | 155 | /** 156 | * Checks whether a handler has ever been stored against an event. 157 | * 158 | * @param {String} eventName The name of the event to check. 159 | * @private 160 | * @memberOf EventEmitter 161 | */ 162 | lunr.EventEmitter.prototype.hasHandler = function (name) { 163 | return name in this.events 164 | } 165 | 166 | /*! 167 | * lunr.tokenizer 168 | * Copyright (C) 2015 Oliver Nightingale 169 | */ 170 | 171 | /** 172 | * A function for splitting a string into tokens ready to be inserted into 173 | * the search index. 174 | * 175 | * @module 176 | * @param {String} obj The string to convert into tokens 177 | * @returns {Array} 178 | */ 179 | lunr.tokenizer = function (obj) { 180 | if (!arguments.length || obj == null || obj == undefined) return [] 181 | if (Array.isArray(obj)) return obj.map(function (t) { return t.toLowerCase() }) 182 | 183 | return obj.toString().trim().toLowerCase().split(/[\s\-]+/) 184 | } 185 | 186 | /*! 187 | * lunr.Pipeline 188 | * Copyright (C) 2015 Oliver Nightingale 189 | */ 190 | 191 | /** 192 | * lunr.Pipelines maintain an ordered list of functions to be applied to all 193 | * tokens in documents entering the search index and queries being ran against 194 | * the index. 195 | * 196 | * An instance of lunr.Index created with the lunr shortcut will contain a 197 | * pipeline with a stop word filter and an English language stemmer. Extra 198 | * functions can be added before or after either of these functions or these 199 | * default functions can be removed. 200 | * 201 | * When run the pipeline will call each function in turn, passing a token, the 202 | * index of that token in the original list of all tokens and finally a list of 203 | * all the original tokens. 204 | * 205 | * The output of functions in the pipeline will be passed to the next function 206 | * in the pipeline. To exclude a token from entering the index the function 207 | * should return undefined, the rest of the pipeline will not be called with 208 | * this token. 209 | * 210 | * For serialisation of pipelines to work, all functions used in an instance of 211 | * a pipeline should be registered with lunr.Pipeline. Registered functions can 212 | * then be loaded. If trying to load a serialised pipeline that uses functions 213 | * that are not registered an error will be thrown. 214 | * 215 | * If not planning on serialising the pipeline then registering pipeline functions 216 | * is not necessary. 217 | * 218 | * @constructor 219 | */ 220 | lunr.Pipeline = function () { 221 | this._stack = [] 222 | } 223 | 224 | lunr.Pipeline.registeredFunctions = {} 225 | 226 | /** 227 | * Register a function with the pipeline. 228 | * 229 | * Functions that are used in the pipeline should be registered if the pipeline 230 | * needs to be serialised, or a serialised pipeline needs to be loaded. 231 | * 232 | * Registering a function does not add it to a pipeline, functions must still be 233 | * added to instances of the pipeline for them to be used when running a pipeline. 234 | * 235 | * @param {Function} fn The function to check for. 236 | * @param {String} label The label to register this function with 237 | * @memberOf Pipeline 238 | */ 239 | lunr.Pipeline.registerFunction = function (fn, label) { 240 | if (label in this.registeredFunctions) { 241 | lunr.utils.warn('Overwriting existing registered function: ' + label) 242 | } 243 | 244 | fn.label = label 245 | lunr.Pipeline.registeredFunctions[fn.label] = fn 246 | } 247 | 248 | /** 249 | * Warns if the function is not registered as a Pipeline function. 250 | * 251 | * @param {Function} fn The function to check for. 252 | * @private 253 | * @memberOf Pipeline 254 | */ 255 | lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) { 256 | var isRegistered = fn.label && (fn.label in this.registeredFunctions) 257 | 258 | if (!isRegistered) { 259 | lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn) 260 | } 261 | } 262 | 263 | /** 264 | * Loads a previously serialised pipeline. 265 | * 266 | * All functions to be loaded must already be registered with lunr.Pipeline. 267 | * If any function from the serialised data has not been registered then an 268 | * error will be thrown. 269 | * 270 | * @param {Object} serialised The serialised pipeline to load. 271 | * @returns {lunr.Pipeline} 272 | * @memberOf Pipeline 273 | */ 274 | lunr.Pipeline.load = function (serialised) { 275 | var pipeline = new lunr.Pipeline 276 | 277 | serialised.forEach(function (fnName) { 278 | var fn = lunr.Pipeline.registeredFunctions[fnName] 279 | 280 | if (fn) { 281 | pipeline.add(fn) 282 | } else { 283 | throw new Error('Cannot load un-registered function: ' + fnName) 284 | } 285 | }) 286 | 287 | return pipeline 288 | } 289 | 290 | /** 291 | * Adds new functions to the end of the pipeline. 292 | * 293 | * Logs a warning if the function has not been registered. 294 | * 295 | * @param {Function} functions Any number of functions to add to the pipeline. 296 | * @memberOf Pipeline 297 | */ 298 | lunr.Pipeline.prototype.add = function () { 299 | var fns = Array.prototype.slice.call(arguments) 300 | 301 | fns.forEach(function (fn) { 302 | lunr.Pipeline.warnIfFunctionNotRegistered(fn) 303 | this._stack.push(fn) 304 | }, this) 305 | } 306 | 307 | /** 308 | * Adds a single function after a function that already exists in the 309 | * pipeline. 310 | * 311 | * Logs a warning if the function has not been registered. 312 | * 313 | * @param {Function} existingFn A function that already exists in the pipeline. 314 | * @param {Function} newFn The new function to add to the pipeline. 315 | * @memberOf Pipeline 316 | */ 317 | lunr.Pipeline.prototype.after = function (existingFn, newFn) { 318 | lunr.Pipeline.warnIfFunctionNotRegistered(newFn) 319 | 320 | var pos = this._stack.indexOf(existingFn) 321 | if (pos == -1) { 322 | throw new Error('Cannot find existingFn') 323 | } 324 | 325 | pos = pos + 1 326 | this._stack.splice(pos, 0, newFn) 327 | } 328 | 329 | /** 330 | * Adds a single function before a function that already exists in the 331 | * pipeline. 332 | * 333 | * Logs a warning if the function has not been registered. 334 | * 335 | * @param {Function} existingFn A function that already exists in the pipeline. 336 | * @param {Function} newFn The new function to add to the pipeline. 337 | * @memberOf Pipeline 338 | */ 339 | lunr.Pipeline.prototype.before = function (existingFn, newFn) { 340 | lunr.Pipeline.warnIfFunctionNotRegistered(newFn) 341 | 342 | var pos = this._stack.indexOf(existingFn) 343 | if (pos == -1) { 344 | throw new Error('Cannot find existingFn') 345 | } 346 | 347 | this._stack.splice(pos, 0, newFn) 348 | } 349 | 350 | /** 351 | * Removes a function from the pipeline. 352 | * 353 | * @param {Function} fn The function to remove from the pipeline. 354 | * @memberOf Pipeline 355 | */ 356 | lunr.Pipeline.prototype.remove = function (fn) { 357 | var pos = this._stack.indexOf(fn) 358 | if (pos == -1) { 359 | return 360 | } 361 | 362 | this._stack.splice(pos, 1) 363 | } 364 | 365 | /** 366 | * Runs the current list of functions that make up the pipeline against the 367 | * passed tokens. 368 | * 369 | * @param {Array} tokens The tokens to run through the pipeline. 370 | * @returns {Array} 371 | * @memberOf Pipeline 372 | */ 373 | lunr.Pipeline.prototype.run = function (tokens) { 374 | var out = [], 375 | tokenLength = tokens.length, 376 | stackLength = this._stack.length 377 | 378 | for (var i = 0; i < tokenLength; i++) { 379 | var token = tokens[i] 380 | 381 | for (var j = 0; j < stackLength; j++) { 382 | token = this._stack[j](token, i, tokens) 383 | if (token === void 0) break 384 | }; 385 | 386 | if (token !== void 0) out.push(token) 387 | }; 388 | 389 | return out 390 | } 391 | 392 | /** 393 | * Resets the pipeline by removing any existing processors. 394 | * 395 | * @memberOf Pipeline 396 | */ 397 | lunr.Pipeline.prototype.reset = function () { 398 | this._stack = [] 399 | } 400 | 401 | /** 402 | * Returns a representation of the pipeline ready for serialisation. 403 | * 404 | * Logs a warning if the function has not been registered. 405 | * 406 | * @returns {Array} 407 | * @memberOf Pipeline 408 | */ 409 | lunr.Pipeline.prototype.toJSON = function () { 410 | return this._stack.map(function (fn) { 411 | lunr.Pipeline.warnIfFunctionNotRegistered(fn) 412 | 413 | return fn.label 414 | }) 415 | } 416 | /*! 417 | * lunr.Vector 418 | * Copyright (C) 2015 Oliver Nightingale 419 | */ 420 | 421 | /** 422 | * lunr.Vectors implement vector related operations for 423 | * a series of elements. 424 | * 425 | * @constructor 426 | */ 427 | lunr.Vector = function () { 428 | this._magnitude = null 429 | this.list = undefined 430 | this.length = 0 431 | } 432 | 433 | /** 434 | * lunr.Vector.Node is a simple struct for each node 435 | * in a lunr.Vector. 436 | * 437 | * @private 438 | * @param {Number} The index of the node in the vector. 439 | * @param {Object} The data at this node in the vector. 440 | * @param {lunr.Vector.Node} The node directly after this node in the vector. 441 | * @constructor 442 | * @memberOf Vector 443 | */ 444 | lunr.Vector.Node = function (idx, val, next) { 445 | this.idx = idx 446 | this.val = val 447 | this.next = next 448 | } 449 | 450 | /** 451 | * Inserts a new value at a position in a vector. 452 | * 453 | * @param {Number} The index at which to insert a value. 454 | * @param {Object} The object to insert in the vector. 455 | * @memberOf Vector. 456 | */ 457 | lunr.Vector.prototype.insert = function (idx, val) { 458 | this._magnitude = undefined; 459 | var list = this.list 460 | 461 | if (!list) { 462 | this.list = new lunr.Vector.Node (idx, val, list) 463 | return this.length++ 464 | } 465 | 466 | if (idx < list.idx) { 467 | this.list = new lunr.Vector.Node (idx, val, list) 468 | return this.length++ 469 | } 470 | 471 | var prev = list, 472 | next = list.next 473 | 474 | while (next != undefined) { 475 | if (idx < next.idx) { 476 | prev.next = new lunr.Vector.Node (idx, val, next) 477 | return this.length++ 478 | } 479 | 480 | prev = next, next = next.next 481 | } 482 | 483 | prev.next = new lunr.Vector.Node (idx, val, next) 484 | return this.length++ 485 | } 486 | 487 | /** 488 | * Calculates the magnitude of this vector. 489 | * 490 | * @returns {Number} 491 | * @memberOf Vector 492 | */ 493 | lunr.Vector.prototype.magnitude = function () { 494 | if (this._magnitude) return this._magnitude 495 | var node = this.list, 496 | sumOfSquares = 0, 497 | val 498 | 499 | while (node) { 500 | val = node.val 501 | sumOfSquares += val * val 502 | node = node.next 503 | } 504 | 505 | return this._magnitude = Math.sqrt(sumOfSquares) 506 | } 507 | 508 | /** 509 | * Calculates the dot product of this vector and another vector. 510 | * 511 | * @param {lunr.Vector} otherVector The vector to compute the dot product with. 512 | * @returns {Number} 513 | * @memberOf Vector 514 | */ 515 | lunr.Vector.prototype.dot = function (otherVector) { 516 | var node = this.list, 517 | otherNode = otherVector.list, 518 | dotProduct = 0 519 | 520 | while (node && otherNode) { 521 | if (node.idx < otherNode.idx) { 522 | node = node.next 523 | } else if (node.idx > otherNode.idx) { 524 | otherNode = otherNode.next 525 | } else { 526 | dotProduct += node.val * otherNode.val 527 | node = node.next 528 | otherNode = otherNode.next 529 | } 530 | } 531 | 532 | return dotProduct 533 | } 534 | 535 | /** 536 | * Calculates the cosine similarity between this vector and another 537 | * vector. 538 | * 539 | * @param {lunr.Vector} otherVector The other vector to calculate the 540 | * similarity with. 541 | * @returns {Number} 542 | * @memberOf Vector 543 | */ 544 | lunr.Vector.prototype.similarity = function (otherVector) { 545 | return this.dot(otherVector) / (this.magnitude() * otherVector.magnitude()) 546 | } 547 | /*! 548 | * lunr.SortedSet 549 | * Copyright (C) 2015 Oliver Nightingale 550 | */ 551 | 552 | /** 553 | * lunr.SortedSets are used to maintain an array of uniq values in a sorted 554 | * order. 555 | * 556 | * @constructor 557 | */ 558 | lunr.SortedSet = function () { 559 | this.length = 0 560 | this.elements = [] 561 | } 562 | 563 | /** 564 | * Loads a previously serialised sorted set. 565 | * 566 | * @param {Array} serialisedData The serialised set to load. 567 | * @returns {lunr.SortedSet} 568 | * @memberOf SortedSet 569 | */ 570 | lunr.SortedSet.load = function (serialisedData) { 571 | var set = new this 572 | 573 | set.elements = serialisedData 574 | set.length = serialisedData.length 575 | 576 | return set 577 | } 578 | 579 | /** 580 | * Inserts new items into the set in the correct position to maintain the 581 | * order. 582 | * 583 | * @param {Object} The objects to add to this set. 584 | * @memberOf SortedSet 585 | */ 586 | lunr.SortedSet.prototype.add = function () { 587 | var i, element 588 | 589 | for (i = 0; i < arguments.length; i++) { 590 | element = arguments[i] 591 | if (~this.indexOf(element)) continue 592 | this.elements.splice(this.locationFor(element), 0, element) 593 | } 594 | 595 | this.length = this.elements.length 596 | } 597 | 598 | /** 599 | * Converts this sorted set into an array. 600 | * 601 | * @returns {Array} 602 | * @memberOf SortedSet 603 | */ 604 | lunr.SortedSet.prototype.toArray = function () { 605 | return this.elements.slice() 606 | } 607 | 608 | /** 609 | * Creates a new array with the results of calling a provided function on every 610 | * element in this sorted set. 611 | * 612 | * Delegates to Array.prototype.map and has the same signature. 613 | * 614 | * @param {Function} fn The function that is called on each element of the 615 | * set. 616 | * @param {Object} ctx An optional object that can be used as the context 617 | * for the function fn. 618 | * @returns {Array} 619 | * @memberOf SortedSet 620 | */ 621 | lunr.SortedSet.prototype.map = function (fn, ctx) { 622 | return this.elements.map(fn, ctx) 623 | } 624 | 625 | /** 626 | * Executes a provided function once per sorted set element. 627 | * 628 | * Delegates to Array.prototype.forEach and has the same signature. 629 | * 630 | * @param {Function} fn The function that is called on each element of the 631 | * set. 632 | * @param {Object} ctx An optional object that can be used as the context 633 | * @memberOf SortedSet 634 | * for the function fn. 635 | */ 636 | lunr.SortedSet.prototype.forEach = function (fn, ctx) { 637 | return this.elements.forEach(fn, ctx) 638 | } 639 | 640 | /** 641 | * Returns the index at which a given element can be found in the 642 | * sorted set, or -1 if it is not present. 643 | * 644 | * @param {Object} elem The object to locate in the sorted set. 645 | * @returns {Number} 646 | * @memberOf SortedSet 647 | */ 648 | lunr.SortedSet.prototype.indexOf = function (elem) { 649 | var start = 0, 650 | end = this.elements.length, 651 | sectionLength = end - start, 652 | pivot = start + Math.floor(sectionLength / 2), 653 | pivotElem = this.elements[pivot] 654 | 655 | while (sectionLength > 1) { 656 | if (pivotElem === elem) return pivot 657 | 658 | if (pivotElem < elem) start = pivot 659 | if (pivotElem > elem) end = pivot 660 | 661 | sectionLength = end - start 662 | pivot = start + Math.floor(sectionLength / 2) 663 | pivotElem = this.elements[pivot] 664 | } 665 | 666 | if (pivotElem === elem) return pivot 667 | 668 | return -1 669 | } 670 | 671 | /** 672 | * Returns the position within the sorted set that an element should be 673 | * inserted at to maintain the current order of the set. 674 | * 675 | * This function assumes that the element to search for does not already exist 676 | * in the sorted set. 677 | * 678 | * @param {Object} elem The elem to find the position for in the set 679 | * @returns {Number} 680 | * @memberOf SortedSet 681 | */ 682 | lunr.SortedSet.prototype.locationFor = function (elem) { 683 | var start = 0, 684 | end = this.elements.length, 685 | sectionLength = end - start, 686 | pivot = start + Math.floor(sectionLength / 2), 687 | pivotElem = this.elements[pivot] 688 | 689 | while (sectionLength > 1) { 690 | if (pivotElem < elem) start = pivot 691 | if (pivotElem > elem) end = pivot 692 | 693 | sectionLength = end - start 694 | pivot = start + Math.floor(sectionLength / 2) 695 | pivotElem = this.elements[pivot] 696 | } 697 | 698 | if (pivotElem > elem) return pivot 699 | if (pivotElem < elem) return pivot + 1 700 | } 701 | 702 | /** 703 | * Creates a new lunr.SortedSet that contains the elements in the intersection 704 | * of this set and the passed set. 705 | * 706 | * @param {lunr.SortedSet} otherSet The set to intersect with this set. 707 | * @returns {lunr.SortedSet} 708 | * @memberOf SortedSet 709 | */ 710 | lunr.SortedSet.prototype.intersect = function (otherSet) { 711 | var intersectSet = new lunr.SortedSet, 712 | i = 0, j = 0, 713 | a_len = this.length, b_len = otherSet.length, 714 | a = this.elements, b = otherSet.elements 715 | 716 | while (true) { 717 | if (i > a_len - 1 || j > b_len - 1) break 718 | 719 | if (a[i] === b[j]) { 720 | intersectSet.add(a[i]) 721 | i++, j++ 722 | continue 723 | } 724 | 725 | if (a[i] < b[j]) { 726 | i++ 727 | continue 728 | } 729 | 730 | if (a[i] > b[j]) { 731 | j++ 732 | continue 733 | } 734 | }; 735 | 736 | return intersectSet 737 | } 738 | 739 | /** 740 | * Makes a copy of this set 741 | * 742 | * @returns {lunr.SortedSet} 743 | * @memberOf SortedSet 744 | */ 745 | lunr.SortedSet.prototype.clone = function () { 746 | var clone = new lunr.SortedSet 747 | 748 | clone.elements = this.toArray() 749 | clone.length = clone.elements.length 750 | 751 | return clone 752 | } 753 | 754 | /** 755 | * Creates a new lunr.SortedSet that contains the elements in the union 756 | * of this set and the passed set. 757 | * 758 | * @param {lunr.SortedSet} otherSet The set to union with this set. 759 | * @returns {lunr.SortedSet} 760 | * @memberOf SortedSet 761 | */ 762 | lunr.SortedSet.prototype.union = function (otherSet) { 763 | var longSet, shortSet, unionSet 764 | 765 | if (this.length >= otherSet.length) { 766 | longSet = this, shortSet = otherSet 767 | } else { 768 | longSet = otherSet, shortSet = this 769 | } 770 | 771 | unionSet = longSet.clone() 772 | 773 | unionSet.add.apply(unionSet, shortSet.toArray()) 774 | 775 | return unionSet 776 | } 777 | 778 | /** 779 | * Returns a representation of the sorted set ready for serialisation. 780 | * 781 | * @returns {Array} 782 | * @memberOf SortedSet 783 | */ 784 | lunr.SortedSet.prototype.toJSON = function () { 785 | return this.toArray() 786 | } 787 | /*! 788 | * lunr.Index 789 | * Copyright (C) 2015 Oliver Nightingale 790 | */ 791 | 792 | /** 793 | * lunr.Index is object that manages a search index. It contains the indexes 794 | * and stores all the tokens and document lookups. It also provides the main 795 | * user facing API for the library. 796 | * 797 | * @constructor 798 | */ 799 | lunr.Index = function () { 800 | this._fields = [] 801 | this._ref = 'id' 802 | this.pipeline = new lunr.Pipeline 803 | this.documentStore = new lunr.Store 804 | this.tokenStore = new lunr.TokenStore 805 | this.corpusTokens = new lunr.SortedSet 806 | this.eventEmitter = new lunr.EventEmitter 807 | 808 | this._idfCache = {} 809 | 810 | this.on('add', 'remove', 'update', (function () { 811 | this._idfCache = {} 812 | }).bind(this)) 813 | } 814 | 815 | /** 816 | * Bind a handler to events being emitted by the index. 817 | * 818 | * The handler can be bound to many events at the same time. 819 | * 820 | * @param {String} [eventName] The name(s) of events to bind the function to. 821 | * @param {Function} fn The serialised set to load. 822 | * @memberOf Index 823 | */ 824 | lunr.Index.prototype.on = function () { 825 | var args = Array.prototype.slice.call(arguments) 826 | return this.eventEmitter.addListener.apply(this.eventEmitter, args) 827 | } 828 | 829 | /** 830 | * Removes a handler from an event being emitted by the index. 831 | * 832 | * @param {String} eventName The name of events to remove the function from. 833 | * @param {Function} fn The serialised set to load. 834 | * @memberOf Index 835 | */ 836 | lunr.Index.prototype.off = function (name, fn) { 837 | return this.eventEmitter.removeListener(name, fn) 838 | } 839 | 840 | /** 841 | * Loads a previously serialised index. 842 | * 843 | * Issues a warning if the index being imported was serialised 844 | * by a different version of lunr. 845 | * 846 | * @param {Object} serialisedData The serialised set to load. 847 | * @returns {lunr.Index} 848 | * @memberOf Index 849 | */ 850 | lunr.Index.load = function (serialisedData) { 851 | if (serialisedData.version !== lunr.version) { 852 | lunr.utils.warn('version mismatch: current ' + lunr.version + ' importing ' + serialisedData.version) 853 | } 854 | 855 | var idx = new this 856 | 857 | idx._fields = serialisedData.fields 858 | idx._ref = serialisedData.ref 859 | 860 | idx.documentStore = lunr.Store.load(serialisedData.documentStore) 861 | idx.tokenStore = lunr.TokenStore.load(serialisedData.tokenStore) 862 | idx.corpusTokens = lunr.SortedSet.load(serialisedData.corpusTokens) 863 | idx.pipeline = lunr.Pipeline.load(serialisedData.pipeline) 864 | 865 | return idx 866 | } 867 | 868 | /** 869 | * Adds a field to the list of fields that will be searchable within documents 870 | * in the index. 871 | * 872 | * An optional boost param can be passed to affect how much tokens in this field 873 | * rank in search results, by default the boost value is 1. 874 | * 875 | * Fields should be added before any documents are added to the index, fields 876 | * that are added after documents are added to the index will only apply to new 877 | * documents added to the index. 878 | * 879 | * @param {String} fieldName The name of the field within the document that 880 | * should be indexed 881 | * @param {Number} boost An optional boost that can be applied to terms in this 882 | * field. 883 | * @returns {lunr.Index} 884 | * @memberOf Index 885 | */ 886 | lunr.Index.prototype.field = function (fieldName, opts) { 887 | var opts = opts || {}, 888 | field = { name: fieldName, boost: opts.boost || 1 } 889 | 890 | this._fields.push(field) 891 | return this 892 | } 893 | 894 | /** 895 | * Sets the property used to uniquely identify documents added to the index, 896 | * by default this property is 'id'. 897 | * 898 | * This should only be changed before adding documents to the index, changing 899 | * the ref property without resetting the index can lead to unexpected results. 900 | * 901 | * @param {String} refName The property to use to uniquely identify the 902 | * documents in the index. 903 | * @param {Boolean} emitEvent Whether to emit add events, defaults to true 904 | * @returns {lunr.Index} 905 | * @memberOf Index 906 | */ 907 | lunr.Index.prototype.ref = function (refName) { 908 | this._ref = refName 909 | return this 910 | } 911 | 912 | /** 913 | * Add a document to the index. 914 | * 915 | * This is the way new documents enter the index, this function will run the 916 | * fields from the document through the index's pipeline and then add it to 917 | * the index, it will then show up in search results. 918 | * 919 | * An 'add' event is emitted with the document that has been added and the index 920 | * the document has been added to. This event can be silenced by passing false 921 | * as the second argument to add. 922 | * 923 | * @param {Object} doc The document to add to the index. 924 | * @param {Boolean} emitEvent Whether or not to emit events, default true. 925 | * @memberOf Index 926 | */ 927 | lunr.Index.prototype.add = function (doc, emitEvent) { 928 | var docTokens = {}, 929 | allDocumentTokens = new lunr.SortedSet, 930 | docRef = doc[this._ref], 931 | emitEvent = emitEvent === undefined ? true : emitEvent 932 | 933 | this._fields.forEach(function (field) { 934 | var fieldTokens = this.pipeline.run(lunr.tokenizer(doc[field.name])) 935 | 936 | docTokens[field.name] = fieldTokens 937 | lunr.SortedSet.prototype.add.apply(allDocumentTokens, fieldTokens) 938 | }, this) 939 | 940 | this.documentStore.set(docRef, allDocumentTokens) 941 | lunr.SortedSet.prototype.add.apply(this.corpusTokens, allDocumentTokens.toArray()) 942 | 943 | for (var i = 0; i < allDocumentTokens.length; i++) { 944 | var token = allDocumentTokens.elements[i] 945 | var tf = this._fields.reduce(function (memo, field) { 946 | var fieldLength = docTokens[field.name].length 947 | 948 | if (!fieldLength) return memo 949 | 950 | var tokenCount = docTokens[field.name].filter(function (t) { return t === token }).length 951 | 952 | return memo + (tokenCount / fieldLength * field.boost) 953 | }, 0) 954 | 955 | this.tokenStore.add(token, { ref: docRef, tf: tf }) 956 | }; 957 | 958 | if (emitEvent) this.eventEmitter.emit('add', doc, this) 959 | } 960 | 961 | /** 962 | * Removes a document from the index. 963 | * 964 | * To make sure documents no longer show up in search results they can be 965 | * removed from the index using this method. 966 | * 967 | * The document passed only needs to have the same ref property value as the 968 | * document that was added to the index, they could be completely different 969 | * objects. 970 | * 971 | * A 'remove' event is emitted with the document that has been removed and the index 972 | * the document has been removed from. This event can be silenced by passing false 973 | * as the second argument to remove. 974 | * 975 | * @param {Object} doc The document to remove from the index. 976 | * @param {Boolean} emitEvent Whether to emit remove events, defaults to true 977 | * @memberOf Index 978 | */ 979 | lunr.Index.prototype.remove = function (doc, emitEvent) { 980 | var docRef = doc[this._ref], 981 | emitEvent = emitEvent === undefined ? true : emitEvent 982 | 983 | if (!this.documentStore.has(docRef)) return 984 | 985 | var docTokens = this.documentStore.get(docRef) 986 | 987 | this.documentStore.remove(docRef) 988 | 989 | docTokens.forEach(function (token) { 990 | this.tokenStore.remove(token, docRef) 991 | }, this) 992 | 993 | if (emitEvent) this.eventEmitter.emit('remove', doc, this) 994 | } 995 | 996 | /** 997 | * Updates a document in the index. 998 | * 999 | * When a document contained within the index gets updated, fields changed, 1000 | * added or removed, to make sure it correctly matched against search queries, 1001 | * it should be updated in the index. 1002 | * 1003 | * This method is just a wrapper around `remove` and `add` 1004 | * 1005 | * An 'update' event is emitted with the document that has been updated and the index. 1006 | * This event can be silenced by passing false as the second argument to update. Only 1007 | * an update event will be fired, the 'add' and 'remove' events of the underlying calls 1008 | * are silenced. 1009 | * 1010 | * @param {Object} doc The document to update in the index. 1011 | * @param {Boolean} emitEvent Whether to emit update events, defaults to true 1012 | * @see Index.prototype.remove 1013 | * @see Index.prototype.add 1014 | * @memberOf Index 1015 | */ 1016 | lunr.Index.prototype.update = function (doc, emitEvent) { 1017 | var emitEvent = emitEvent === undefined ? true : emitEvent 1018 | 1019 | this.remove(doc, false) 1020 | this.add(doc, false) 1021 | 1022 | if (emitEvent) this.eventEmitter.emit('update', doc, this) 1023 | } 1024 | 1025 | /** 1026 | * Calculates the inverse document frequency for a token within the index. 1027 | * 1028 | * @param {String} token The token to calculate the idf of. 1029 | * @see Index.prototype.idf 1030 | * @private 1031 | * @memberOf Index 1032 | */ 1033 | lunr.Index.prototype.idf = function (term) { 1034 | var cacheKey = "@" + term 1035 | if (Object.prototype.hasOwnProperty.call(this._idfCache, cacheKey)) return this._idfCache[cacheKey] 1036 | 1037 | var documentFrequency = this.tokenStore.count(term), 1038 | idf = 1 1039 | 1040 | if (documentFrequency > 0) { 1041 | idf = 1 + Math.log(this.documentStore.length / documentFrequency) 1042 | } 1043 | 1044 | return this._idfCache[cacheKey] = idf 1045 | } 1046 | 1047 | /** 1048 | * Searches the index using the passed query. 1049 | * 1050 | * Queries should be a string, multiple words are allowed and will lead to an 1051 | * AND based query, e.g. `idx.search('foo bar')` will run a search for 1052 | * documents containing both 'foo' and 'bar'. 1053 | * 1054 | * All query tokens are passed through the same pipeline that document tokens 1055 | * are passed through, so any language processing involved will be run on every 1056 | * query term. 1057 | * 1058 | * Each query term is expanded, so that the term 'he' might be expanded to 1059 | * 'hello' and 'help' if those terms were already included in the index. 1060 | * 1061 | * Matching documents are returned as an array of objects, each object contains 1062 | * the matching document ref, as set for this index, and the similarity score 1063 | * for this document against the query. 1064 | * 1065 | * @param {String} query The query to search the index with. 1066 | * @returns {Object} 1067 | * @see Index.prototype.idf 1068 | * @see Index.prototype.documentVector 1069 | * @memberOf Index 1070 | */ 1071 | lunr.Index.prototype.search = function (query) { 1072 | var queryTokens = this.pipeline.run(lunr.tokenizer(query)), 1073 | queryVector = new lunr.Vector, 1074 | documentSets = [], 1075 | fieldBoosts = this._fields.reduce(function (memo, f) { return memo + f.boost }, 0) 1076 | 1077 | var hasSomeToken = queryTokens.some(function (token) { 1078 | return this.tokenStore.has(token) 1079 | }, this) 1080 | 1081 | if (!hasSomeToken) return [] 1082 | 1083 | queryTokens 1084 | .forEach(function (token, i, tokens) { 1085 | var tf = 1 / tokens.length * this._fields.length * fieldBoosts, 1086 | self = this 1087 | 1088 | var set = this.tokenStore.expand(token).reduce(function (memo, key) { 1089 | var pos = self.corpusTokens.indexOf(key), 1090 | idf = self.idf(key), 1091 | similarityBoost = 1, 1092 | set = new lunr.SortedSet 1093 | 1094 | // if the expanded key is not an exact match to the token then 1095 | // penalise the score for this key by how different the key is 1096 | // to the token. 1097 | if (key !== token) { 1098 | var diff = Math.max(3, key.length - token.length) 1099 | similarityBoost = 1 / Math.log(diff) 1100 | } 1101 | 1102 | // calculate the query tf-idf score for this token 1103 | // applying an similarityBoost to ensure exact matches 1104 | // these rank higher than expanded terms 1105 | if (pos > -1) queryVector.insert(pos, tf * idf * similarityBoost) 1106 | 1107 | // add all the documents that have this key into a set 1108 | Object.keys(self.tokenStore.get(key)).forEach(function (ref) { set.add(ref) }) 1109 | 1110 | return memo.union(set) 1111 | }, new lunr.SortedSet) 1112 | 1113 | documentSets.push(set) 1114 | }, this) 1115 | 1116 | var documentSet = documentSets.reduce(function (memo, set) { 1117 | return memo.intersect(set) 1118 | }) 1119 | 1120 | return documentSet 1121 | .map(function (ref) { 1122 | return { ref: ref, score: queryVector.similarity(this.documentVector(ref)) } 1123 | }, this) 1124 | .sort(function (a, b) { 1125 | return b.score - a.score 1126 | }) 1127 | } 1128 | 1129 | /** 1130 | * Generates a vector containing all the tokens in the document matching the 1131 | * passed documentRef. 1132 | * 1133 | * The vector contains the tf-idf score for each token contained in the 1134 | * document with the passed documentRef. The vector will contain an element 1135 | * for every token in the indexes corpus, if the document does not contain that 1136 | * token the element will be 0. 1137 | * 1138 | * @param {Object} documentRef The ref to find the document with. 1139 | * @returns {lunr.Vector} 1140 | * @private 1141 | * @memberOf Index 1142 | */ 1143 | lunr.Index.prototype.documentVector = function (documentRef) { 1144 | var documentTokens = this.documentStore.get(documentRef), 1145 | documentTokensLength = documentTokens.length, 1146 | documentVector = new lunr.Vector 1147 | 1148 | for (var i = 0; i < documentTokensLength; i++) { 1149 | var token = documentTokens.elements[i], 1150 | tf = this.tokenStore.get(token)[documentRef].tf, 1151 | idf = this.idf(token) 1152 | 1153 | documentVector.insert(this.corpusTokens.indexOf(token), tf * idf) 1154 | }; 1155 | 1156 | return documentVector 1157 | } 1158 | 1159 | /** 1160 | * Returns a representation of the index ready for serialisation. 1161 | * 1162 | * @returns {Object} 1163 | * @memberOf Index 1164 | */ 1165 | lunr.Index.prototype.toJSON = function () { 1166 | return { 1167 | version: lunr.version, 1168 | fields: this._fields, 1169 | ref: this._ref, 1170 | documentStore: this.documentStore.toJSON(), 1171 | tokenStore: this.tokenStore.toJSON(), 1172 | corpusTokens: this.corpusTokens.toJSON(), 1173 | pipeline: this.pipeline.toJSON() 1174 | } 1175 | } 1176 | 1177 | /** 1178 | * Applies a plugin to the current index. 1179 | * 1180 | * A plugin is a function that is called with the index as its context. 1181 | * Plugins can be used to customise or extend the behaviour the index 1182 | * in some way. A plugin is just a function, that encapsulated the custom 1183 | * behaviour that should be applied to the index. 1184 | * 1185 | * The plugin function will be called with the index as its argument, additional 1186 | * arguments can also be passed when calling use. The function will be called 1187 | * with the index as its context. 1188 | * 1189 | * Example: 1190 | * 1191 | * var myPlugin = function (idx, arg1, arg2) { 1192 | * // `this` is the index to be extended 1193 | * // apply any extensions etc here. 1194 | * } 1195 | * 1196 | * var idx = lunr(function () { 1197 | * this.use(myPlugin, 'arg1', 'arg2') 1198 | * }) 1199 | * 1200 | * @param {Function} plugin The plugin to apply. 1201 | * @memberOf Index 1202 | */ 1203 | lunr.Index.prototype.use = function (plugin) { 1204 | var args = Array.prototype.slice.call(arguments, 1) 1205 | args.unshift(this) 1206 | plugin.apply(this, args) 1207 | } 1208 | /*! 1209 | * lunr.Store 1210 | * Copyright (C) 2015 Oliver Nightingale 1211 | */ 1212 | 1213 | /** 1214 | * lunr.Store is a simple key-value store used for storing sets of tokens for 1215 | * documents stored in index. 1216 | * 1217 | * @constructor 1218 | * @module 1219 | */ 1220 | lunr.Store = function () { 1221 | this.store = {} 1222 | this.length = 0 1223 | } 1224 | 1225 | /** 1226 | * Loads a previously serialised store 1227 | * 1228 | * @param {Object} serialisedData The serialised store to load. 1229 | * @returns {lunr.Store} 1230 | * @memberOf Store 1231 | */ 1232 | lunr.Store.load = function (serialisedData) { 1233 | var store = new this 1234 | 1235 | store.length = serialisedData.length 1236 | store.store = Object.keys(serialisedData.store).reduce(function (memo, key) { 1237 | memo[key] = lunr.SortedSet.load(serialisedData.store[key]) 1238 | return memo 1239 | }, {}) 1240 | 1241 | return store 1242 | } 1243 | 1244 | /** 1245 | * Stores the given tokens in the store against the given id. 1246 | * 1247 | * @param {Object} id The key used to store the tokens against. 1248 | * @param {Object} tokens The tokens to store against the key. 1249 | * @memberOf Store 1250 | */ 1251 | lunr.Store.prototype.set = function (id, tokens) { 1252 | if (!this.has(id)) this.length++ 1253 | this.store[id] = tokens 1254 | } 1255 | 1256 | /** 1257 | * Retrieves the tokens from the store for a given key. 1258 | * 1259 | * @param {Object} id The key to lookup and retrieve from the store. 1260 | * @returns {Object} 1261 | * @memberOf Store 1262 | */ 1263 | lunr.Store.prototype.get = function (id) { 1264 | return this.store[id] 1265 | } 1266 | 1267 | /** 1268 | * Checks whether the store contains a key. 1269 | * 1270 | * @param {Object} id The id to look up in the store. 1271 | * @returns {Boolean} 1272 | * @memberOf Store 1273 | */ 1274 | lunr.Store.prototype.has = function (id) { 1275 | return id in this.store 1276 | } 1277 | 1278 | /** 1279 | * Removes the value for a key in the store. 1280 | * 1281 | * @param {Object} id The id to remove from the store. 1282 | * @memberOf Store 1283 | */ 1284 | lunr.Store.prototype.remove = function (id) { 1285 | if (!this.has(id)) return 1286 | 1287 | delete this.store[id] 1288 | this.length-- 1289 | } 1290 | 1291 | /** 1292 | * Returns a representation of the store ready for serialisation. 1293 | * 1294 | * @returns {Object} 1295 | * @memberOf Store 1296 | */ 1297 | lunr.Store.prototype.toJSON = function () { 1298 | return { 1299 | store: this.store, 1300 | length: this.length 1301 | } 1302 | } 1303 | 1304 | /*! 1305 | * lunr.stemmer 1306 | * Copyright (C) 2015 Oliver Nightingale 1307 | * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt 1308 | */ 1309 | 1310 | /** 1311 | * lunr.stemmer is an english language stemmer, this is a JavaScript 1312 | * implementation of the PorterStemmer taken from http://tartarus.org/~martin 1313 | * 1314 | * @module 1315 | * @param {String} str The string to stem 1316 | * @returns {String} 1317 | * @see lunr.Pipeline 1318 | */ 1319 | lunr.stemmer = (function(){ 1320 | var step2list = { 1321 | "ational" : "ate", 1322 | "tional" : "tion", 1323 | "enci" : "ence", 1324 | "anci" : "ance", 1325 | "izer" : "ize", 1326 | "bli" : "ble", 1327 | "alli" : "al", 1328 | "entli" : "ent", 1329 | "eli" : "e", 1330 | "ousli" : "ous", 1331 | "ization" : "ize", 1332 | "ation" : "ate", 1333 | "ator" : "ate", 1334 | "alism" : "al", 1335 | "iveness" : "ive", 1336 | "fulness" : "ful", 1337 | "ousness" : "ous", 1338 | "aliti" : "al", 1339 | "iviti" : "ive", 1340 | "biliti" : "ble", 1341 | "logi" : "log" 1342 | }, 1343 | 1344 | step3list = { 1345 | "icate" : "ic", 1346 | "ative" : "", 1347 | "alize" : "al", 1348 | "iciti" : "ic", 1349 | "ical" : "ic", 1350 | "ful" : "", 1351 | "ness" : "" 1352 | }, 1353 | 1354 | c = "[^aeiou]", // consonant 1355 | v = "[aeiouy]", // vowel 1356 | C = c + "[^aeiouy]*", // consonant sequence 1357 | V = v + "[aeiou]*", // vowel sequence 1358 | 1359 | mgr0 = "^(" + C + ")?" + V + C, // [C]VC... is m>0 1360 | meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", // [C]VC[V] is m=1 1361 | mgr1 = "^(" + C + ")?" + V + C + V + C, // [C]VCVC... is m>1 1362 | s_v = "^(" + C + ")?" + v; // vowel in stem 1363 | 1364 | var re_mgr0 = new RegExp(mgr0); 1365 | var re_mgr1 = new RegExp(mgr1); 1366 | var re_meq1 = new RegExp(meq1); 1367 | var re_s_v = new RegExp(s_v); 1368 | 1369 | var re_1a = /^(.+?)(ss|i)es$/; 1370 | var re2_1a = /^(.+?)([^s])s$/; 1371 | var re_1b = /^(.+?)eed$/; 1372 | var re2_1b = /^(.+?)(ed|ing)$/; 1373 | var re_1b_2 = /.$/; 1374 | var re2_1b_2 = /(at|bl|iz)$/; 1375 | var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$"); 1376 | var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 1377 | 1378 | var re_1c = /^(.+?[^aeiou])y$/; 1379 | var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 1380 | 1381 | var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 1382 | 1383 | var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 1384 | var re2_4 = /^(.+?)(s|t)(ion)$/; 1385 | 1386 | var re_5 = /^(.+?)e$/; 1387 | var re_5_1 = /ll$/; 1388 | var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 1389 | 1390 | var porterStemmer = function porterStemmer(w) { 1391 | var stem, 1392 | suffix, 1393 | firstch, 1394 | re, 1395 | re2, 1396 | re3, 1397 | re4; 1398 | 1399 | if (w.length < 3) { return w; } 1400 | 1401 | firstch = w.substr(0,1); 1402 | if (firstch == "y") { 1403 | w = firstch.toUpperCase() + w.substr(1); 1404 | } 1405 | 1406 | // Step 1a 1407 | re = re_1a 1408 | re2 = re2_1a; 1409 | 1410 | if (re.test(w)) { w = w.replace(re,"$1$2"); } 1411 | else if (re2.test(w)) { w = w.replace(re2,"$1$2"); } 1412 | 1413 | // Step 1b 1414 | re = re_1b; 1415 | re2 = re2_1b; 1416 | if (re.test(w)) { 1417 | var fp = re.exec(w); 1418 | re = re_mgr0; 1419 | if (re.test(fp[1])) { 1420 | re = re_1b_2; 1421 | w = w.replace(re,""); 1422 | } 1423 | } else if (re2.test(w)) { 1424 | var fp = re2.exec(w); 1425 | stem = fp[1]; 1426 | re2 = re_s_v; 1427 | if (re2.test(stem)) { 1428 | w = stem; 1429 | re2 = re2_1b_2; 1430 | re3 = re3_1b_2; 1431 | re4 = re4_1b_2; 1432 | if (re2.test(w)) { w = w + "e"; } 1433 | else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,""); } 1434 | else if (re4.test(w)) { w = w + "e"; } 1435 | } 1436 | } 1437 | 1438 | // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say) 1439 | re = re_1c; 1440 | if (re.test(w)) { 1441 | var fp = re.exec(w); 1442 | stem = fp[1]; 1443 | w = stem + "i"; 1444 | } 1445 | 1446 | // Step 2 1447 | re = re_2; 1448 | if (re.test(w)) { 1449 | var fp = re.exec(w); 1450 | stem = fp[1]; 1451 | suffix = fp[2]; 1452 | re = re_mgr0; 1453 | if (re.test(stem)) { 1454 | w = stem + step2list[suffix]; 1455 | } 1456 | } 1457 | 1458 | // Step 3 1459 | re = re_3; 1460 | if (re.test(w)) { 1461 | var fp = re.exec(w); 1462 | stem = fp[1]; 1463 | suffix = fp[2]; 1464 | re = re_mgr0; 1465 | if (re.test(stem)) { 1466 | w = stem + step3list[suffix]; 1467 | } 1468 | } 1469 | 1470 | // Step 4 1471 | re = re_4; 1472 | re2 = re2_4; 1473 | if (re.test(w)) { 1474 | var fp = re.exec(w); 1475 | stem = fp[1]; 1476 | re = re_mgr1; 1477 | if (re.test(stem)) { 1478 | w = stem; 1479 | } 1480 | } else if (re2.test(w)) { 1481 | var fp = re2.exec(w); 1482 | stem = fp[1] + fp[2]; 1483 | re2 = re_mgr1; 1484 | if (re2.test(stem)) { 1485 | w = stem; 1486 | } 1487 | } 1488 | 1489 | // Step 5 1490 | re = re_5; 1491 | if (re.test(w)) { 1492 | var fp = re.exec(w); 1493 | stem = fp[1]; 1494 | re = re_mgr1; 1495 | re2 = re_meq1; 1496 | re3 = re3_5; 1497 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) { 1498 | w = stem; 1499 | } 1500 | } 1501 | 1502 | re = re_5_1; 1503 | re2 = re_mgr1; 1504 | if (re.test(w) && re2.test(w)) { 1505 | re = re_1b_2; 1506 | w = w.replace(re,""); 1507 | } 1508 | 1509 | // and turn initial Y back to y 1510 | 1511 | if (firstch == "y") { 1512 | w = firstch.toLowerCase() + w.substr(1); 1513 | } 1514 | 1515 | return w; 1516 | }; 1517 | 1518 | return porterStemmer; 1519 | })(); 1520 | 1521 | lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer') 1522 | /*! 1523 | * lunr.stopWordFilter 1524 | * Copyright (C) 2015 Oliver Nightingale 1525 | */ 1526 | 1527 | /** 1528 | * lunr.stopWordFilter is an English language stop word list filter, any words 1529 | * contained in the list will not be passed through the filter. 1530 | * 1531 | * This is intended to be used in the Pipeline. If the token does not pass the 1532 | * filter then undefined will be returned. 1533 | * 1534 | * @module 1535 | * @param {String} token The token to pass through the filter 1536 | * @returns {String} 1537 | * @see lunr.Pipeline 1538 | */ 1539 | lunr.stopWordFilter = function (token) { 1540 | if (token && lunr.stopWordFilter.stopWords[token] !== token) return token; 1541 | } 1542 | 1543 | lunr.stopWordFilter.stopWords = { 1544 | 'a': 'a', 1545 | 'able': 'able', 1546 | 'about': 'about', 1547 | 'across': 'across', 1548 | 'after': 'after', 1549 | 'all': 'all', 1550 | 'almost': 'almost', 1551 | 'also': 'also', 1552 | 'am': 'am', 1553 | 'among': 'among', 1554 | 'an': 'an', 1555 | 'and': 'and', 1556 | 'any': 'any', 1557 | 'are': 'are', 1558 | 'as': 'as', 1559 | 'at': 'at', 1560 | 'be': 'be', 1561 | 'because': 'because', 1562 | 'been': 'been', 1563 | 'but': 'but', 1564 | 'by': 'by', 1565 | 'can': 'can', 1566 | 'cannot': 'cannot', 1567 | 'could': 'could', 1568 | 'dear': 'dear', 1569 | 'did': 'did', 1570 | 'do': 'do', 1571 | 'does': 'does', 1572 | 'either': 'either', 1573 | 'else': 'else', 1574 | 'ever': 'ever', 1575 | 'every': 'every', 1576 | 'for': 'for', 1577 | 'from': 'from', 1578 | 'get': 'get', 1579 | 'got': 'got', 1580 | 'had': 'had', 1581 | 'has': 'has', 1582 | 'have': 'have', 1583 | 'he': 'he', 1584 | 'her': 'her', 1585 | 'hers': 'hers', 1586 | 'him': 'him', 1587 | 'his': 'his', 1588 | 'how': 'how', 1589 | 'however': 'however', 1590 | 'i': 'i', 1591 | 'if': 'if', 1592 | 'in': 'in', 1593 | 'into': 'into', 1594 | 'is': 'is', 1595 | 'it': 'it', 1596 | 'its': 'its', 1597 | 'just': 'just', 1598 | 'least': 'least', 1599 | 'let': 'let', 1600 | 'like': 'like', 1601 | 'likely': 'likely', 1602 | 'may': 'may', 1603 | 'me': 'me', 1604 | 'might': 'might', 1605 | 'most': 'most', 1606 | 'must': 'must', 1607 | 'my': 'my', 1608 | 'neither': 'neither', 1609 | 'no': 'no', 1610 | 'nor': 'nor', 1611 | 'not': 'not', 1612 | 'of': 'of', 1613 | 'off': 'off', 1614 | 'often': 'often', 1615 | 'on': 'on', 1616 | 'only': 'only', 1617 | 'or': 'or', 1618 | 'other': 'other', 1619 | 'our': 'our', 1620 | 'own': 'own', 1621 | 'rather': 'rather', 1622 | 'said': 'said', 1623 | 'say': 'say', 1624 | 'says': 'says', 1625 | 'she': 'she', 1626 | 'should': 'should', 1627 | 'since': 'since', 1628 | 'so': 'so', 1629 | 'some': 'some', 1630 | 'than': 'than', 1631 | 'that': 'that', 1632 | 'the': 'the', 1633 | 'their': 'their', 1634 | 'them': 'them', 1635 | 'then': 'then', 1636 | 'there': 'there', 1637 | 'these': 'these', 1638 | 'they': 'they', 1639 | 'this': 'this', 1640 | 'tis': 'tis', 1641 | 'to': 'to', 1642 | 'too': 'too', 1643 | 'twas': 'twas', 1644 | 'us': 'us', 1645 | 'wants': 'wants', 1646 | 'was': 'was', 1647 | 'we': 'we', 1648 | 'were': 'were', 1649 | 'what': 'what', 1650 | 'when': 'when', 1651 | 'where': 'where', 1652 | 'which': 'which', 1653 | 'while': 'while', 1654 | 'who': 'who', 1655 | 'whom': 'whom', 1656 | 'why': 'why', 1657 | 'will': 'will', 1658 | 'with': 'with', 1659 | 'would': 'would', 1660 | 'yet': 'yet', 1661 | 'you': 'you', 1662 | 'your': 'your' 1663 | } 1664 | 1665 | lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter') 1666 | /*! 1667 | * lunr.trimmer 1668 | * Copyright (C) 2015 Oliver Nightingale 1669 | */ 1670 | 1671 | /** 1672 | * lunr.trimmer is a pipeline function for trimming non word 1673 | * characters from the begining and end of tokens before they 1674 | * enter the index. 1675 | * 1676 | * This implementation may not work correctly for non latin 1677 | * characters and should either be removed or adapted for use 1678 | * with languages with non-latin characters. 1679 | * 1680 | * @module 1681 | * @param {String} token The token to pass through the filter 1682 | * @returns {String} 1683 | * @see lunr.Pipeline 1684 | */ 1685 | lunr.trimmer = function (token) { 1686 | var result = token.replace(/^\W+/, '') 1687 | .replace(/\W+$/, '') 1688 | return result === '' ? undefined : result 1689 | } 1690 | 1691 | lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer') 1692 | /*! 1693 | * lunr.stemmer 1694 | * Copyright (C) 2015 Oliver Nightingale 1695 | * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt 1696 | */ 1697 | 1698 | /** 1699 | * lunr.TokenStore is used for efficient storing and lookup of the reverse 1700 | * index of token to document ref. 1701 | * 1702 | * @constructor 1703 | */ 1704 | lunr.TokenStore = function () { 1705 | this.root = { docs: {} } 1706 | this.length = 0 1707 | } 1708 | 1709 | /** 1710 | * Loads a previously serialised token store 1711 | * 1712 | * @param {Object} serialisedData The serialised token store to load. 1713 | * @returns {lunr.TokenStore} 1714 | * @memberOf TokenStore 1715 | */ 1716 | lunr.TokenStore.load = function (serialisedData) { 1717 | var store = new this 1718 | 1719 | store.root = serialisedData.root 1720 | store.length = serialisedData.length 1721 | 1722 | return store 1723 | } 1724 | 1725 | /** 1726 | * Adds a new token doc pair to the store. 1727 | * 1728 | * By default this function starts at the root of the current store, however 1729 | * it can start at any node of any token store if required. 1730 | * 1731 | * @param {String} token The token to store the doc under 1732 | * @param {Object} doc The doc to store against the token 1733 | * @param {Object} root An optional node at which to start looking for the 1734 | * correct place to enter the doc, by default the root of this lunr.TokenStore 1735 | * is used. 1736 | * @memberOf TokenStore 1737 | */ 1738 | lunr.TokenStore.prototype.add = function (token, doc, root) { 1739 | var root = root || this.root, 1740 | key = token[0], 1741 | rest = token.slice(1) 1742 | 1743 | if (!(key in root)) root[key] = {docs: {}} 1744 | 1745 | if (rest.length === 0) { 1746 | root[key].docs[doc.ref] = doc 1747 | this.length += 1 1748 | return 1749 | } else { 1750 | return this.add(rest, doc, root[key]) 1751 | } 1752 | } 1753 | 1754 | /** 1755 | * Checks whether this key is contained within this lunr.TokenStore. 1756 | * 1757 | * By default this function starts at the root of the current store, however 1758 | * it can start at any node of any token store if required. 1759 | * 1760 | * @param {String} token The token to check for 1761 | * @param {Object} root An optional node at which to start 1762 | * @memberOf TokenStore 1763 | */ 1764 | lunr.TokenStore.prototype.has = function (token) { 1765 | if (!token) return false 1766 | 1767 | var node = this.root 1768 | 1769 | for (var i = 0; i < token.length; i++) { 1770 | if (!node[token[i]]) return false 1771 | 1772 | node = node[token[i]] 1773 | } 1774 | 1775 | return true 1776 | } 1777 | 1778 | /** 1779 | * Retrieve a node from the token store for a given token. 1780 | * 1781 | * By default this function starts at the root of the current store, however 1782 | * it can start at any node of any token store if required. 1783 | * 1784 | * @param {String} token The token to get the node for. 1785 | * @param {Object} root An optional node at which to start. 1786 | * @returns {Object} 1787 | * @see TokenStore.prototype.get 1788 | * @memberOf TokenStore 1789 | */ 1790 | lunr.TokenStore.prototype.getNode = function (token) { 1791 | if (!token) return {} 1792 | 1793 | var node = this.root 1794 | 1795 | for (var i = 0; i < token.length; i++) { 1796 | if (!node[token[i]]) return {} 1797 | 1798 | node = node[token[i]] 1799 | } 1800 | 1801 | return node 1802 | } 1803 | 1804 | /** 1805 | * Retrieve the documents for a node for the given token. 1806 | * 1807 | * By default this function starts at the root of the current store, however 1808 | * it can start at any node of any token store if required. 1809 | * 1810 | * @param {String} token The token to get the documents for. 1811 | * @param {Object} root An optional node at which to start. 1812 | * @returns {Object} 1813 | * @memberOf TokenStore 1814 | */ 1815 | lunr.TokenStore.prototype.get = function (token, root) { 1816 | return this.getNode(token, root).docs || {} 1817 | } 1818 | 1819 | lunr.TokenStore.prototype.count = function (token, root) { 1820 | return Object.keys(this.get(token, root)).length 1821 | } 1822 | 1823 | /** 1824 | * Remove the document identified by ref from the token in the store. 1825 | * 1826 | * By default this function starts at the root of the current store, however 1827 | * it can start at any node of any token store if required. 1828 | * 1829 | * @param {String} token The token to get the documents for. 1830 | * @param {String} ref The ref of the document to remove from this token. 1831 | * @param {Object} root An optional node at which to start. 1832 | * @returns {Object} 1833 | * @memberOf TokenStore 1834 | */ 1835 | lunr.TokenStore.prototype.remove = function (token, ref) { 1836 | if (!token) return 1837 | var node = this.root 1838 | 1839 | for (var i = 0; i < token.length; i++) { 1840 | if (!(token[i] in node)) return 1841 | node = node[token[i]] 1842 | } 1843 | 1844 | delete node.docs[ref] 1845 | } 1846 | 1847 | /** 1848 | * Find all the possible suffixes of the passed token using tokens 1849 | * currently in the store. 1850 | * 1851 | * @param {String} token The token to expand. 1852 | * @returns {Array} 1853 | * @memberOf TokenStore 1854 | */ 1855 | lunr.TokenStore.prototype.expand = function (token, memo) { 1856 | var root = this.getNode(token), 1857 | docs = root.docs || {}, 1858 | memo = memo || [] 1859 | 1860 | if (Object.keys(docs).length) memo.push(token) 1861 | 1862 | Object.keys(root) 1863 | .forEach(function (key) { 1864 | if (key === 'docs') return 1865 | 1866 | memo.concat(this.expand(token + key, memo)) 1867 | }, this) 1868 | 1869 | return memo 1870 | } 1871 | 1872 | /** 1873 | * Returns a representation of the token store ready for serialisation. 1874 | * 1875 | * @returns {Object} 1876 | * @memberOf TokenStore 1877 | */ 1878 | lunr.TokenStore.prototype.toJSON = function () { 1879 | return { 1880 | root: this.root, 1881 | length: this.length 1882 | } 1883 | } 1884 | 1885 | 1886 | /** 1887 | * export the module via AMD, CommonJS or as a browser global 1888 | * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js 1889 | */ 1890 | ;(function (root, factory) { 1891 | if (typeof define === 'function' && define.amd) { 1892 | // AMD. Register as an anonymous module. 1893 | define(factory) 1894 | } else if (typeof exports === 'object') { 1895 | /** 1896 | * Node. Does not work with strict CommonJS, but 1897 | * only CommonJS-like enviroments that support module.exports, 1898 | * like Node. 1899 | */ 1900 | module.exports = factory() 1901 | } else { 1902 | // Browser globals (root is window) 1903 | root.lunr = factory() 1904 | } 1905 | }(this, function () { 1906 | /** 1907 | * Just return a value to define the module export. 1908 | * This example returns an object, but the module 1909 | * can return a function as the exported value. 1910 | */ 1911 | return lunr 1912 | })) 1913 | })(); 1914 | -------------------------------------------------------------------------------- /book/gitbook/gitbook-plugin-lunr/search-lunr.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Define global search engine 6 | function LunrSearchEngine() { 7 | this.index = null; 8 | this.store = {}; 9 | this.name = 'LunrSearchEngine'; 10 | } 11 | 12 | // Initialize lunr by fetching the search index 13 | LunrSearchEngine.prototype.init = function() { 14 | var that = this; 15 | var d = $.Deferred(); 16 | 17 | $.getJSON(gitbook.state.basePath+'/search_index.json') 18 | .then(function(data) { 19 | // eslint-disable-next-line no-undef 20 | that.index = lunr.Index.load(data.index); 21 | that.store = data.store; 22 | d.resolve(); 23 | }); 24 | 25 | return d.promise(); 26 | }; 27 | 28 | // Search for a term and return results 29 | LunrSearchEngine.prototype.search = function(q, offset, length) { 30 | var that = this; 31 | var results = []; 32 | 33 | if (this.index) { 34 | results = $.map(this.index.search(q), function(result) { 35 | var doc = that.store[result.ref]; 36 | 37 | return { 38 | title: doc.title, 39 | url: doc.url, 40 | body: doc.summary || doc.body 41 | }; 42 | }); 43 | } 44 | 45 | return $.Deferred().resolve({ 46 | query: q, 47 | results: results.slice(0, length), 48 | count: results.length 49 | }).promise(); 50 | }; 51 | 52 | // Set gitbook research 53 | gitbook.events.bind('start', function(e, config) { 54 | var engine = gitbook.search.getEngine(); 55 | if (!engine) { 56 | gitbook.search.setEngine(LunrSearchEngine, config); 57 | } 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /book/gitbook/gitbook-plugin-search/search-engine.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Global search objects 6 | var engine = null; 7 | var initialized = false; 8 | 9 | // Set a new search engine 10 | function setEngine(Engine, config) { 11 | initialized = false; 12 | engine = new Engine(config); 13 | 14 | init(config); 15 | } 16 | 17 | // Initialize search engine with config 18 | function init(config) { 19 | if (!engine) throw new Error('No engine set for research. Set an engine using gitbook.research.setEngine(Engine).'); 20 | 21 | return engine.init(config) 22 | .then(function() { 23 | initialized = true; 24 | gitbook.events.trigger('search.ready'); 25 | }); 26 | } 27 | 28 | // Launch search for query q 29 | function query(q, offset, length) { 30 | if (!initialized) throw new Error('Search has not been initialized'); 31 | return engine.search(q, offset, length); 32 | } 33 | 34 | // Get stats about search 35 | function getEngine() { 36 | return engine? engine.name : null; 37 | } 38 | 39 | function isInitialized() { 40 | return initialized; 41 | } 42 | 43 | // Initialize gitbook.search 44 | gitbook.search = { 45 | setEngine: setEngine, 46 | getEngine: getEngine, 47 | query: query, 48 | isInitialized: isInitialized 49 | }; 50 | }); -------------------------------------------------------------------------------- /book/gitbook/gitbook-plugin-search/search.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | var MAX_RESULTS = 15; 6 | var MAX_DESCRIPTION_SIZE = 500; 7 | 8 | var usePushState = (typeof history.pushState !== 'undefined'); 9 | 10 | // DOM Elements 11 | var $body = $('body'); 12 | var $bookSearchResults; 13 | var $searchInput; 14 | var $searchList; 15 | var $searchTitle; 16 | var $searchResultsCount; 17 | var $searchQuery; 18 | 19 | // Throttle search 20 | function throttle(fn, wait) { 21 | var timeout; 22 | 23 | return function() { 24 | var ctx = this, args = arguments; 25 | if (!timeout) { 26 | timeout = setTimeout(function() { 27 | timeout = null; 28 | fn.apply(ctx, args); 29 | }, wait); 30 | } 31 | }; 32 | } 33 | 34 | function displayResults(res) { 35 | $bookSearchResults.addClass('open'); 36 | 37 | var noResults = res.count == 0; 38 | $bookSearchResults.toggleClass('no-results', noResults); 39 | 40 | // Clear old results 41 | $searchList.empty(); 42 | 43 | // Display title for research 44 | $searchResultsCount.text(res.count); 45 | $searchQuery.text(res.query); 46 | 47 | // Create an
').html(content);
65 |
66 | $link.appendTo($title);
67 | $title.appendTo($li);
68 | $content.appendTo($li);
69 | $li.appendTo($searchList);
70 | });
71 | }
72 |
73 | function launchSearch(q) {
74 | // Add class for loading
75 | $body.addClass('with-search');
76 | $body.addClass('search-loading');
77 |
78 | // Launch search query
79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS)
80 | .then(function(results) {
81 | displayResults(results);
82 | })
83 | .always(function() {
84 | $body.removeClass('search-loading');
85 | }), 1000);
86 | }
87 |
88 | function closeSearch() {
89 | $body.removeClass('with-search');
90 | $bookSearchResults.removeClass('open');
91 | }
92 |
93 | function launchSearchFromQueryString() {
94 | var q = getParameterByName('q');
95 | if (q && q.length > 0) {
96 | // Update search input
97 | $searchInput.val(q);
98 |
99 | // Launch search
100 | launchSearch(q);
101 | }
102 | }
103 |
104 | function bindSearch() {
105 | // Bind DOM
106 | $searchInput = $('#book-search-input input');
107 | $bookSearchResults = $('#book-search-results');
108 | $searchList = $bookSearchResults.find('.search-results-list');
109 | $searchTitle = $bookSearchResults.find('.search-results-title');
110 | $searchResultsCount = $searchTitle.find('.search-results-count');
111 | $searchQuery = $searchTitle.find('.search-query');
112 |
113 | // Launch query based on input content
114 | function handleUpdate() {
115 | var q = $searchInput.val();
116 |
117 | if (q.length == 0) {
118 | closeSearch();
119 | }
120 | else {
121 | launchSearch(q);
122 | }
123 | }
124 |
125 | // Detect true content change in search input
126 | // Workaround for IE < 9
127 | var propertyChangeUnbound = false;
128 | $searchInput.on('propertychange', function(e) {
129 | if (e.originalEvent.propertyName == 'value') {
130 | handleUpdate();
131 | }
132 | });
133 |
134 | // HTML5 (IE9 & others)
135 | $searchInput.on('input', function(e) {
136 | // Unbind propertychange event for IE9+
137 | if (!propertyChangeUnbound) {
138 | $(this).unbind('propertychange');
139 | propertyChangeUnbound = true;
140 | }
141 |
142 | handleUpdate();
143 | });
144 |
145 | // Push to history on blur
146 | $searchInput.on('blur', function(e) {
147 | // Update history state
148 | if (usePushState) {
149 | var uri = updateQueryString('q', $(this).val());
150 | history.pushState({ path: uri }, null, uri);
151 | }
152 | });
153 | }
154 |
155 | gitbook.events.on('page.change', function() {
156 | bindSearch();
157 | closeSearch();
158 |
159 | // Launch search based on query parameter
160 | if (gitbook.search.isInitialized()) {
161 | launchSearchFromQueryString();
162 | }
163 | });
164 |
165 | gitbook.events.on('search.ready', function() {
166 | bindSearch();
167 |
168 | // Launch search from query param at start
169 | launchSearchFromQueryString();
170 | });
171 |
172 | function getParameterByName(name) {
173 | var url = window.location.href;
174 | name = name.replace(/[\[\]]/g, '\\$&');
175 | var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)', 'i'),
176 | results = regex.exec(url);
177 | if (!results) return null;
178 | if (!results[2]) return '';
179 | return decodeURIComponent(results[2].replace(/\+/g, ' '));
180 | }
181 |
182 | function updateQueryString(key, value) {
183 | value = encodeURIComponent(value);
184 |
185 | var url = window.location.href;
186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'),
187 | hash;
188 |
189 | if (re.test(url)) {
190 | if (typeof value !== 'undefined' && value !== null)
191 | return url.replace(re, '$1' + key + '=' + value + '$2$3');
192 | else {
193 | hash = url.split('#');
194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, '');
195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null)
196 | url += '#' + hash[1];
197 | return url;
198 | }
199 | }
200 | else {
201 | if (typeof value !== 'undefined' && value !== null) {
202 | var separator = url.indexOf('?') !== -1 ? '&' : '?';
203 | hash = url.split('#');
204 | url = hash[0] + separator + key + '=' + value;
205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null)
206 | url += '#' + hash[1];
207 | return url;
208 | }
209 | else
210 | return url;
211 | }
212 | }
213 | });
214 |
--------------------------------------------------------------------------------
/book/gitbook/gitbook-plugin-sharing/buttons.js:
--------------------------------------------------------------------------------
1 | require(['gitbook', 'jquery'], function(gitbook, $) {
2 | var SITES = {
3 | 'facebook': {
4 | 'label': 'Facebook',
5 | 'icon': 'fa fa-facebook',
6 | 'onClick': function(e) {
7 | e.preventDefault();
8 | window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href));
9 | }
10 | },
11 | 'twitter': {
12 | 'label': 'Twitter',
13 | 'icon': 'fa fa-twitter',
14 | 'onClick': function(e) {
15 | e.preventDefault();
16 | window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href));
17 | }
18 | },
19 | 'google': {
20 | 'label': 'Google+',
21 | 'icon': 'fa fa-google-plus',
22 | 'onClick': function(e) {
23 | e.preventDefault();
24 | window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href));
25 | }
26 | },
27 | 'weibo': {
28 | 'label': 'Weibo',
29 | 'icon': 'fa fa-weibo',
30 | 'onClick': function(e) {
31 | e.preventDefault();
32 | window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title));
33 | }
34 | },
35 | 'instapaper': {
36 | 'label': 'Instapaper',
37 | 'icon': 'fa fa-instapaper',
38 | 'onClick': function(e) {
39 | e.preventDefault();
40 | window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href));
41 | }
42 | },
43 | 'vk': {
44 | 'label': 'VK',
45 | 'icon': 'fa fa-vk',
46 | 'onClick': function(e) {
47 | e.preventDefault();
48 | window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href));
49 | }
50 | }
51 | };
52 |
53 |
54 |
55 | gitbook.events.bind('start', function(e, config) {
56 | var opts = config.sharing;
57 |
58 | // Create dropdown menu
59 | var menu = $.map(opts.all, function(id) {
60 | var site = SITES[id];
61 |
62 | return {
63 | text: site.label,
64 | onClick: site.onClick
65 | };
66 | });
67 |
68 | // Create main button with dropdown
69 | if (menu.length > 0) {
70 | gitbook.toolbar.createButton({
71 | icon: 'fa fa-share-alt',
72 | label: 'Share',
73 | position: 'right',
74 | dropdown: [menu]
75 | });
76 | }
77 |
78 | // Direct actions to share
79 | $.each(SITES, function(sideId, site) {
80 | if (!opts[sideId]) return;
81 |
82 | gitbook.toolbar.createButton({
83 | icon: site.icon,
84 | label: site.text,
85 | position: 'right',
86 | onClick: site.onClick
87 | });
88 | });
89 | });
90 | });
91 |
--------------------------------------------------------------------------------
/book/gitbook/style.css:
--------------------------------------------------------------------------------
1 | /*! normalize.css v2.1.0 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}.link-inherit{color:inherit}.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.alert{padding:15px;margin-bottom:20px;color:#444;background:#eee;border-bottom:5px solid #ddd}.alert-success{background:#dff0d8;border-color:#d6e9c6;color:#3c763d}.alert-info{background:#d9edf7;border-color:#bce8f1;color:#31708f}.alert-danger{background:#f2dede;border-color:#ebccd1;color:#a94442}.alert-warning{background:#fcf8e3;border-color:#faebcc;color:#8a6d3b}/*!
2 | * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome
3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
4 | */
5 | @font-face{font-family:FontAwesome;src:url(fonts/fontawesome/fontawesome-webfont.eot?v=4.6.3);src:url(fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.6.3) format('embedded-opentype'),url(fonts/fontawesome/fontawesome-webfont.woff2?v=4.6.3) format('woff2'),url(fonts/fontawesome/fontawesome-webfont.woff?v=4.6.3) format('woff'),url(fonts/fontawesome/fontawesome-webfont.ttf?v=4.6.3) format('truetype'),url(fonts/fontawesome/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular) format('svg');font-weight:400;font-style:normal}
6 | .fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
7 | .fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}
8 | .fa-2x{font-size:2em}
9 | .fa-3x{font-size:3em}
10 | .fa-4x{font-size:4em}
11 | .fa-5x{font-size:5em}
12 | .fa-fw{width:1.28571429em;text-align:center}
13 | .fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}
14 | .fa-ul>li{position:relative}
15 | .fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}
16 | .fa-li.fa-lg{left:-1.85714286em}
17 | .fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}
18 | .fa-pull-left{float:left}
19 | .fa-pull-right{float:right}
20 | .fa.fa-pull-left{margin-right:.3em}
21 | .fa.fa-pull-right{margin-left:.3em}
22 | .pull-right{float:right}
23 | .pull-left{float:left}
24 | .fa.pull-left{margin-right:.3em}
25 | .fa.pull-right{margin-left:.3em}
26 | .fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}
27 | .fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}
28 | @-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}
29 | 100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}
30 | }
31 | @keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}
32 | 100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}
33 | }
34 | .fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}
35 | .fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}
36 | .fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}
37 | .fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}
38 | .fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}
39 | :root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{filter:none}
40 | .fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}
41 | .fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}
42 | .fa-stack-1x{line-height:inherit}
43 | .fa-stack-2x{font-size:2em}
44 | .fa-inverse{color:#fff}
45 | .fa-glass:before{content:"\f000"}
46 | .fa-music:before{content:"\f001"}
47 | .fa-search:before{content:"\f002"}
48 | .fa-envelope-o:before{content:"\f003"}
49 | .fa-heart:before{content:"\f004"}
50 | .fa-star:before{content:"\f005"}
51 | .fa-star-o:before{content:"\f006"}
52 | .fa-user:before{content:"\f007"}
53 | .fa-film:before{content:"\f008"}
54 | .fa-th-large:before{content:"\f009"}
55 | .fa-th:before{content:"\f00a"}
56 | .fa-th-list:before{content:"\f00b"}
57 | .fa-check:before{content:"\f00c"}
58 | .fa-close:before,.fa-remove:before,.fa-times:before{content:"\f00d"}
59 | .fa-search-plus:before{content:"\f00e"}
60 | .fa-search-minus:before{content:"\f010"}
61 | .fa-power-off:before{content:"\f011"}
62 | .fa-signal:before{content:"\f012"}
63 | .fa-cog:before,.fa-gear:before{content:"\f013"}
64 | .fa-trash-o:before{content:"\f014"}
65 | .fa-home:before{content:"\f015"}
66 | .fa-file-o:before{content:"\f016"}
67 | .fa-clock-o:before{content:"\f017"}
68 | .fa-road:before{content:"\f018"}
69 | .fa-download:before{content:"\f019"}
70 | .fa-arrow-circle-o-down:before{content:"\f01a"}
71 | .fa-arrow-circle-o-up:before{content:"\f01b"}
72 | .fa-inbox:before{content:"\f01c"}
73 | .fa-play-circle-o:before{content:"\f01d"}
74 | .fa-repeat:before,.fa-rotate-right:before{content:"\f01e"}
75 | .fa-refresh:before{content:"\f021"}
76 | .fa-list-alt:before{content:"\f022"}
77 | .fa-lock:before{content:"\f023"}
78 | .fa-flag:before{content:"\f024"}
79 | .fa-headphones:before{content:"\f025"}
80 | .fa-volume-off:before{content:"\f026"}
81 | .fa-volume-down:before{content:"\f027"}
82 | .fa-volume-up:before{content:"\f028"}
83 | .fa-qrcode:before{content:"\f029"}
84 | .fa-barcode:before{content:"\f02a"}
85 | .fa-tag:before{content:"\f02b"}
86 | .fa-tags:before{content:"\f02c"}
87 | .fa-book:before{content:"\f02d"}
88 | .fa-bookmark:before{content:"\f02e"}
89 | .fa-print:before{content:"\f02f"}
90 | .fa-camera:before{content:"\f030"}
91 | .fa-font:before{content:"\f031"}
92 | .fa-bold:before{content:"\f032"}
93 | .fa-italic:before{content:"\f033"}
94 | .fa-text-height:before{content:"\f034"}
95 | .fa-text-width:before{content:"\f035"}
96 | .fa-align-left:before{content:"\f036"}
97 | .fa-align-center:before{content:"\f037"}
98 | .fa-align-right:before{content:"\f038"}
99 | .fa-align-justify:before{content:"\f039"}
100 | .fa-list:before{content:"\f03a"}
101 | .fa-dedent:before,.fa-outdent:before{content:"\f03b"}
102 | .fa-indent:before{content:"\f03c"}
103 | .fa-video-camera:before{content:"\f03d"}
104 | .fa-image:before,.fa-photo:before,.fa-picture-o:before{content:"\f03e"}
105 | .fa-pencil:before{content:"\f040"}
106 | .fa-map-marker:before{content:"\f041"}
107 | .fa-adjust:before{content:"\f042"}
108 | .fa-tint:before{content:"\f043"}
109 | .fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}
110 | .fa-share-square-o:before{content:"\f045"}
111 | .fa-check-square-o:before{content:"\f046"}
112 | .fa-arrows:before{content:"\f047"}
113 | .fa-step-backward:before{content:"\f048"}
114 | .fa-fast-backward:before{content:"\f049"}
115 | .fa-backward:before{content:"\f04a"}
116 | .fa-play:before{content:"\f04b"}
117 | .fa-pause:before{content:"\f04c"}
118 | .fa-stop:before{content:"\f04d"}
119 | .fa-forward:before{content:"\f04e"}
120 | .fa-fast-forward:before{content:"\f050"}
121 | .fa-step-forward:before{content:"\f051"}
122 | .fa-eject:before{content:"\f052"}
123 | .fa-chevron-left:before{content:"\f053"}
124 | .fa-chevron-right:before{content:"\f054"}
125 | .fa-plus-circle:before{content:"\f055"}
126 | .fa-minus-circle:before{content:"\f056"}
127 | .fa-times-circle:before{content:"\f057"}
128 | .fa-check-circle:before{content:"\f058"}
129 | .fa-question-circle:before{content:"\f059"}
130 | .fa-info-circle:before{content:"\f05a"}
131 | .fa-crosshairs:before{content:"\f05b"}
132 | .fa-times-circle-o:before{content:"\f05c"}
133 | .fa-check-circle-o:before{content:"\f05d"}
134 | .fa-ban:before{content:"\f05e"}
135 | .fa-arrow-left:before{content:"\f060"}
136 | .fa-arrow-right:before{content:"\f061"}
137 | .fa-arrow-up:before{content:"\f062"}
138 | .fa-arrow-down:before{content:"\f063"}
139 | .fa-mail-forward:before,.fa-share:before{content:"\f064"}
140 | .fa-expand:before{content:"\f065"}
141 | .fa-compress:before{content:"\f066"}
142 | .fa-plus:before{content:"\f067"}
143 | .fa-minus:before{content:"\f068"}
144 | .fa-asterisk:before{content:"\f069"}
145 | .fa-exclamation-circle:before{content:"\f06a"}
146 | .fa-gift:before{content:"\f06b"}
147 | .fa-leaf:before{content:"\f06c"}
148 | .fa-fire:before{content:"\f06d"}
149 | .fa-eye:before{content:"\f06e"}
150 | .fa-eye-slash:before{content:"\f070"}
151 | .fa-exclamation-triangle:before,.fa-warning:before{content:"\f071"}
152 | .fa-plane:before{content:"\f072"}
153 | .fa-calendar:before{content:"\f073"}
154 | .fa-random:before{content:"\f074"}
155 | .fa-comment:before{content:"\f075"}
156 | .fa-magnet:before{content:"\f076"}
157 | .fa-chevron-up:before{content:"\f077"}
158 | .fa-chevron-down:before{content:"\f078"}
159 | .fa-retweet:before{content:"\f079"}
160 | .fa-shopping-cart:before{content:"\f07a"}
161 | .fa-folder:before{content:"\f07b"}
162 | .fa-folder-open:before{content:"\f07c"}
163 | .fa-arrows-v:before{content:"\f07d"}
164 | .fa-arrows-h:before{content:"\f07e"}
165 | .fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}
166 | .fa-twitter-square:before{content:"\f081"}
167 | .fa-facebook-square:before{content:"\f082"}
168 | .fa-camera-retro:before{content:"\f083"}
169 | .fa-key:before{content:"\f084"}
170 | .fa-cogs:before,.fa-gears:before{content:"\f085"}
171 | .fa-comments:before{content:"\f086"}
172 | .fa-thumbs-o-up:before{content:"\f087"}
173 | .fa-thumbs-o-down:before{content:"\f088"}
174 | .fa-star-half:before{content:"\f089"}
175 | .fa-heart-o:before{content:"\f08a"}
176 | .fa-sign-out:before{content:"\f08b"}
177 | .fa-linkedin-square:before{content:"\f08c"}
178 | .fa-thumb-tack:before{content:"\f08d"}
179 | .fa-external-link:before{content:"\f08e"}
180 | .fa-sign-in:before{content:"\f090"}
181 | .fa-trophy:before{content:"\f091"}
182 | .fa-github-square:before{content:"\f092"}
183 | .fa-upload:before{content:"\f093"}
184 | .fa-lemon-o:before{content:"\f094"}
185 | .fa-phone:before{content:"\f095"}
186 | .fa-square-o:before{content:"\f096"}
187 | .fa-bookmark-o:before{content:"\f097"}
188 | .fa-phone-square:before{content:"\f098"}
189 | .fa-twitter:before{content:"\f099"}
190 | .fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}
191 | .fa-github:before{content:"\f09b"}
192 | .fa-unlock:before{content:"\f09c"}
193 | .fa-credit-card:before{content:"\f09d"}
194 | .fa-feed:before,.fa-rss:before{content:"\f09e"}
195 | .fa-hdd-o:before{content:"\f0a0"}
196 | .fa-bullhorn:before{content:"\f0a1"}
197 | .fa-bell:before{content:"\f0f3"}
198 | .fa-certificate:before{content:"\f0a3"}
199 | .fa-hand-o-right:before{content:"\f0a4"}
200 | .fa-hand-o-left:before{content:"\f0a5"}
201 | .fa-hand-o-up:before{content:"\f0a6"}
202 | .fa-hand-o-down:before{content:"\f0a7"}
203 | .fa-arrow-circle-left:before{content:"\f0a8"}
204 | .fa-arrow-circle-right:before{content:"\f0a9"}
205 | .fa-arrow-circle-up:before{content:"\f0aa"}
206 | .fa-arrow-circle-down:before{content:"\f0ab"}
207 | .fa-globe:before{content:"\f0ac"}
208 | .fa-wrench:before{content:"\f0ad"}
209 | .fa-tasks:before{content:"\f0ae"}
210 | .fa-filter:before{content:"\f0b0"}
211 | .fa-briefcase:before{content:"\f0b1"}
212 | .fa-arrows-alt:before{content:"\f0b2"}
213 | .fa-group:before,.fa-users:before{content:"\f0c0"}
214 | .fa-chain:before,.fa-link:before{content:"\f0c1"}
215 | .fa-cloud:before{content:"\f0c2"}
216 | .fa-flask:before{content:"\f0c3"}
217 | .fa-cut:before,.fa-scissors:before{content:"\f0c4"}
218 | .fa-copy:before,.fa-files-o:before{content:"\f0c5"}
219 | .fa-paperclip:before{content:"\f0c6"}
220 | .fa-floppy-o:before,.fa-save:before{content:"\f0c7"}
221 | .fa-square:before{content:"\f0c8"}
222 | .fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:"\f0c9"}
223 | .fa-list-ul:before{content:"\f0ca"}
224 | .fa-list-ol:before{content:"\f0cb"}
225 | .fa-strikethrough:before{content:"\f0cc"}
226 | .fa-underline:before{content:"\f0cd"}
227 | .fa-table:before{content:"\f0ce"}
228 | .fa-magic:before{content:"\f0d0"}
229 | .fa-truck:before{content:"\f0d1"}
230 | .fa-pinterest:before{content:"\f0d2"}
231 | .fa-pinterest-square:before{content:"\f0d3"}
232 | .fa-google-plus-square:before{content:"\f0d4"}
233 | .fa-google-plus:before{content:"\f0d5"}
234 | .fa-money:before{content:"\f0d6"}
235 | .fa-caret-down:before{content:"\f0d7"}
236 | .fa-caret-up:before{content:"\f0d8"}
237 | .fa-caret-left:before{content:"\f0d9"}
238 | .fa-caret-right:before{content:"\f0da"}
239 | .fa-columns:before{content:"\f0db"}
240 | .fa-sort:before,.fa-unsorted:before{content:"\f0dc"}
241 | .fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}
242 | .fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}
243 | .fa-envelope:before{content:"\f0e0"}
244 | .fa-linkedin:before{content:"\f0e1"}
245 | .fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}
246 | .fa-gavel:before,.fa-legal:before{content:"\f0e3"}
247 | .fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}
248 | .fa-comment-o:before{content:"\f0e5"}
249 | .fa-comments-o:before{content:"\f0e6"}
250 | .fa-bolt:before,.fa-flash:before{content:"\f0e7"}
251 | .fa-sitemap:before{content:"\f0e8"}
252 | .fa-umbrella:before{content:"\f0e9"}
253 | .fa-clipboard:before,.fa-paste:before{content:"\f0ea"}
254 | .fa-lightbulb-o:before{content:"\f0eb"}
255 | .fa-exchange:before{content:"\f0ec"}
256 | .fa-cloud-download:before{content:"\f0ed"}
257 | .fa-cloud-upload:before{content:"\f0ee"}
258 | .fa-user-md:before{content:"\f0f0"}
259 | .fa-stethoscope:before{content:"\f0f1"}
260 | .fa-suitcase:before{content:"\f0f2"}
261 | .fa-bell-o:before{content:"\f0a2"}
262 | .fa-coffee:before{content:"\f0f4"}
263 | .fa-cutlery:before{content:"\f0f5"}
264 | .fa-file-text-o:before{content:"\f0f6"}
265 | .fa-building-o:before{content:"\f0f7"}
266 | .fa-hospital-o:before{content:"\f0f8"}
267 | .fa-ambulance:before{content:"\f0f9"}
268 | .fa-medkit:before{content:"\f0fa"}
269 | .fa-fighter-jet:before{content:"\f0fb"}
270 | .fa-beer:before{content:"\f0fc"}
271 | .fa-h-square:before{content:"\f0fd"}
272 | .fa-plus-square:before{content:"\f0fe"}
273 | .fa-angle-double-left:before{content:"\f100"}
274 | .fa-angle-double-right:before{content:"\f101"}
275 | .fa-angle-double-up:before{content:"\f102"}
276 | .fa-angle-double-down:before{content:"\f103"}
277 | .fa-angle-left:before{content:"\f104"}
278 | .fa-angle-right:before{content:"\f105"}
279 | .fa-angle-up:before{content:"\f106"}
280 | .fa-angle-down:before{content:"\f107"}
281 | .fa-desktop:before{content:"\f108"}
282 | .fa-laptop:before{content:"\f109"}
283 | .fa-tablet:before{content:"\f10a"}
284 | .fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}
285 | .fa-circle-o:before{content:"\f10c"}
286 | .fa-quote-left:before{content:"\f10d"}
287 | .fa-quote-right:before{content:"\f10e"}
288 | .fa-spinner:before{content:"\f110"}
289 | .fa-circle:before{content:"\f111"}
290 | .fa-mail-reply:before,.fa-reply:before{content:"\f112"}
291 | .fa-github-alt:before{content:"\f113"}
292 | .fa-folder-o:before{content:"\f114"}
293 | .fa-folder-open-o:before{content:"\f115"}
294 | .fa-smile-o:before{content:"\f118"}
295 | .fa-frown-o:before{content:"\f119"}
296 | .fa-meh-o:before{content:"\f11a"}
297 | .fa-gamepad:before{content:"\f11b"}
298 | .fa-keyboard-o:before{content:"\f11c"}
299 | .fa-flag-o:before{content:"\f11d"}
300 | .fa-flag-checkered:before{content:"\f11e"}
301 | .fa-terminal:before{content:"\f120"}
302 | .fa-code:before{content:"\f121"}
303 | .fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}
304 | .fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}
305 | .fa-location-arrow:before{content:"\f124"}
306 | .fa-crop:before{content:"\f125"}
307 | .fa-code-fork:before{content:"\f126"}
308 | .fa-chain-broken:before,.fa-unlink:before{content:"\f127"}
309 | .fa-question:before{content:"\f128"}
310 | .fa-info:before{content:"\f129"}
311 | .fa-exclamation:before{content:"\f12a"}
312 | .fa-superscript:before{content:"\f12b"}
313 | .fa-subscript:before{content:"\f12c"}
314 | .fa-eraser:before{content:"\f12d"}
315 | .fa-puzzle-piece:before{content:"\f12e"}
316 | .fa-microphone:before{content:"\f130"}
317 | .fa-microphone-slash:before{content:"\f131"}
318 | .fa-shield:before{content:"\f132"}
319 | .fa-calendar-o:before{content:"\f133"}
320 | .fa-fire-extinguisher:before{content:"\f134"}
321 | .fa-rocket:before{content:"\f135"}
322 | .fa-maxcdn:before{content:"\f136"}
323 | .fa-chevron-circle-left:before{content:"\f137"}
324 | .fa-chevron-circle-right:before{content:"\f138"}
325 | .fa-chevron-circle-up:before{content:"\f139"}
326 | .fa-chevron-circle-down:before{content:"\f13a"}
327 | .fa-html5:before{content:"\f13b"}
328 | .fa-css3:before{content:"\f13c"}
329 | .fa-anchor:before{content:"\f13d"}
330 | .fa-unlock-alt:before{content:"\f13e"}
331 | .fa-bullseye:before{content:"\f140"}
332 | .fa-ellipsis-h:before{content:"\f141"}
333 | .fa-ellipsis-v:before{content:"\f142"}
334 | .fa-rss-square:before{content:"\f143"}
335 | .fa-play-circle:before{content:"\f144"}
336 | .fa-ticket:before{content:"\f145"}
337 | .fa-minus-square:before{content:"\f146"}
338 | .fa-minus-square-o:before{content:"\f147"}
339 | .fa-level-up:before{content:"\f148"}
340 | .fa-level-down:before{content:"\f149"}
341 | .fa-check-square:before{content:"\f14a"}
342 | .fa-pencil-square:before{content:"\f14b"}
343 | .fa-external-link-square:before{content:"\f14c"}
344 | .fa-share-square:before{content:"\f14d"}
345 | .fa-compass:before{content:"\f14e"}
346 | .fa-caret-square-o-down:before,.fa-toggle-down:before{content:"\f150"}
347 | .fa-caret-square-o-up:before,.fa-toggle-up:before{content:"\f151"}
348 | .fa-caret-square-o-right:before,.fa-toggle-right:before{content:"\f152"}
349 | .fa-eur:before,.fa-euro:before{content:"\f153"}
350 | .fa-gbp:before{content:"\f154"}
351 | .fa-dollar:before,.fa-usd:before{content:"\f155"}
352 | .fa-inr:before,.fa-rupee:before{content:"\f156"}
353 | .fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:"\f157"}
354 | .fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:"\f158"}
355 | .fa-krw:before,.fa-won:before{content:"\f159"}
356 | .fa-bitcoin:before,.fa-btc:before{content:"\f15a"}
357 | .fa-file:before{content:"\f15b"}
358 | .fa-file-text:before{content:"\f15c"}
359 | .fa-sort-alpha-asc:before{content:"\f15d"}
360 | .fa-sort-alpha-desc:before{content:"\f15e"}
361 | .fa-sort-amount-asc:before{content:"\f160"}
362 | .fa-sort-amount-desc:before{content:"\f161"}
363 | .fa-sort-numeric-asc:before{content:"\f162"}
364 | .fa-sort-numeric-desc:before{content:"\f163"}
365 | .fa-thumbs-up:before{content:"\f164"}
366 | .fa-thumbs-down:before{content:"\f165"}
367 | .fa-youtube-square:before{content:"\f166"}
368 | .fa-youtube:before{content:"\f167"}
369 | .fa-xing:before{content:"\f168"}
370 | .fa-xing-square:before{content:"\f169"}
371 | .fa-youtube-play:before{content:"\f16a"}
372 | .fa-dropbox:before{content:"\f16b"}
373 | .fa-stack-overflow:before{content:"\f16c"}
374 | .fa-instagram:before{content:"\f16d"}
375 | .fa-flickr:before{content:"\f16e"}
376 | .fa-adn:before{content:"\f170"}
377 | .fa-bitbucket:before{content:"\f171"}
378 | .fa-bitbucket-square:before{content:"\f172"}
379 | .fa-tumblr:before{content:"\f173"}
380 | .fa-tumblr-square:before{content:"\f174"}
381 | .fa-long-arrow-down:before{content:"\f175"}
382 | .fa-long-arrow-up:before{content:"\f176"}
383 | .fa-long-arrow-left:before{content:"\f177"}
384 | .fa-long-arrow-right:before{content:"\f178"}
385 | .fa-apple:before{content:"\f179"}
386 | .fa-windows:before{content:"\f17a"}
387 | .fa-android:before{content:"\f17b"}
388 | .fa-linux:before{content:"\f17c"}
389 | .fa-dribbble:before{content:"\f17d"}
390 | .fa-skype:before{content:"\f17e"}
391 | .fa-foursquare:before{content:"\f180"}
392 | .fa-trello:before{content:"\f181"}
393 | .fa-female:before{content:"\f182"}
394 | .fa-male:before{content:"\f183"}
395 | .fa-gittip:before,.fa-gratipay:before{content:"\f184"}
396 | .fa-sun-o:before{content:"\f185"}
397 | .fa-moon-o:before{content:"\f186"}
398 | .fa-archive:before{content:"\f187"}
399 | .fa-bug:before{content:"\f188"}
400 | .fa-vk:before{content:"\f189"}
401 | .fa-weibo:before{content:"\f18a"}
402 | .fa-renren:before{content:"\f18b"}
403 | .fa-pagelines:before{content:"\f18c"}
404 | .fa-stack-exchange:before{content:"\f18d"}
405 | .fa-arrow-circle-o-right:before{content:"\f18e"}
406 | .fa-arrow-circle-o-left:before{content:"\f190"}
407 | .fa-caret-square-o-left:before,.fa-toggle-left:before{content:"\f191"}
408 | .fa-dot-circle-o:before{content:"\f192"}
409 | .fa-wheelchair:before{content:"\f193"}
410 | .fa-vimeo-square:before{content:"\f194"}
411 | .fa-try:before,.fa-turkish-lira:before{content:"\f195"}
412 | .fa-plus-square-o:before{content:"\f196"}
413 | .fa-space-shuttle:before{content:"\f197"}
414 | .fa-slack:before{content:"\f198"}
415 | .fa-envelope-square:before{content:"\f199"}
416 | .fa-wordpress:before{content:"\f19a"}
417 | .fa-openid:before{content:"\f19b"}
418 | .fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}
419 | .fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}
420 | .fa-yahoo:before{content:"\f19e"}
421 | .fa-google:before{content:"\f1a0"}
422 | .fa-reddit:before{content:"\f1a1"}
423 | .fa-reddit-square:before{content:"\f1a2"}
424 | .fa-stumbleupon-circle:before{content:"\f1a3"}
425 | .fa-stumbleupon:before{content:"\f1a4"}
426 | .fa-delicious:before{content:"\f1a5"}
427 | .fa-digg:before{content:"\f1a6"}
428 | .fa-pied-piper-pp:before{content:"\f1a7"}
429 | .fa-pied-piper-alt:before{content:"\f1a8"}
430 | .fa-drupal:before{content:"\f1a9"}
431 | .fa-joomla:before{content:"\f1aa"}
432 | .fa-language:before{content:"\f1ab"}
433 | .fa-fax:before{content:"\f1ac"}
434 | .fa-building:before{content:"\f1ad"}
435 | .fa-child:before{content:"\f1ae"}
436 | .fa-paw:before{content:"\f1b0"}
437 | .fa-spoon:before{content:"\f1b1"}
438 | .fa-cube:before{content:"\f1b2"}
439 | .fa-cubes:before{content:"\f1b3"}
440 | .fa-behance:before{content:"\f1b4"}
441 | .fa-behance-square:before{content:"\f1b5"}
442 | .fa-steam:before{content:"\f1b6"}
443 | .fa-steam-square:before{content:"\f1b7"}
444 | .fa-recycle:before{content:"\f1b8"}
445 | .fa-automobile:before,.fa-car:before{content:"\f1b9"}
446 | .fa-cab:before,.fa-taxi:before{content:"\f1ba"}
447 | .fa-tree:before{content:"\f1bb"}
448 | .fa-spotify:before{content:"\f1bc"}
449 | .fa-deviantart:before{content:"\f1bd"}
450 | .fa-soundcloud:before{content:"\f1be"}
451 | .fa-database:before{content:"\f1c0"}
452 | .fa-file-pdf-o:before{content:"\f1c1"}
453 | .fa-file-word-o:before{content:"\f1c2"}
454 | .fa-file-excel-o:before{content:"\f1c3"}
455 | .fa-file-powerpoint-o:before{content:"\f1c4"}
456 | .fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:"\f1c5"}
457 | .fa-file-archive-o:before,.fa-file-zip-o:before{content:"\f1c6"}
458 | .fa-file-audio-o:before,.fa-file-sound-o:before{content:"\f1c7"}
459 | .fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}
460 | .fa-file-code-o:before{content:"\f1c9"}
461 | .fa-vine:before{content:"\f1ca"}
462 | .fa-codepen:before{content:"\f1cb"}
463 | .fa-jsfiddle:before{content:"\f1cc"}
464 | .fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:"\f1cd"}
465 | .fa-circle-o-notch:before{content:"\f1ce"}
466 | .fa-ra:before,.fa-rebel:before,.fa-resistance:before{content:"\f1d0"}
467 | .fa-empire:before,.fa-ge:before{content:"\f1d1"}
468 | .fa-git-square:before{content:"\f1d2"}
469 | .fa-git:before{content:"\f1d3"}
470 | .fa-hacker-news:before,.fa-y-combinator-square:before,.fa-yc-square:before{content:"\f1d4"}
471 | .fa-tencent-weibo:before{content:"\f1d5"}
472 | .fa-qq:before{content:"\f1d6"}
473 | .fa-wechat:before,.fa-weixin:before{content:"\f1d7"}
474 | .fa-paper-plane:before,.fa-send:before{content:"\f1d8"}
475 | .fa-paper-plane-o:before,.fa-send-o:before{content:"\f1d9"}
476 | .fa-history:before{content:"\f1da"}
477 | .fa-circle-thin:before{content:"\f1db"}
478 | .fa-header:before{content:"\f1dc"}
479 | .fa-paragraph:before{content:"\f1dd"}
480 | .fa-sliders:before{content:"\f1de"}
481 | .fa-share-alt:before{content:"\f1e0"}
482 | .fa-share-alt-square:before{content:"\f1e1"}
483 | .fa-bomb:before{content:"\f1e2"}
484 | .fa-futbol-o:before,.fa-soccer-ball-o:before{content:"\f1e3"}
485 | .fa-tty:before{content:"\f1e4"}
486 | .fa-binoculars:before{content:"\f1e5"}
487 | .fa-plug:before{content:"\f1e6"}
488 | .fa-slideshare:before{content:"\f1e7"}
489 | .fa-twitch:before{content:"\f1e8"}
490 | .fa-yelp:before{content:"\f1e9"}
491 | .fa-newspaper-o:before{content:"\f1ea"}
492 | .fa-wifi:before{content:"\f1eb"}
493 | .fa-calculator:before{content:"\f1ec"}
494 | .fa-paypal:before{content:"\f1ed"}
495 | .fa-google-wallet:before{content:"\f1ee"}
496 | .fa-cc-visa:before{content:"\f1f0"}
497 | .fa-cc-mastercard:before{content:"\f1f1"}
498 | .fa-cc-discover:before{content:"\f1f2"}
499 | .fa-cc-amex:before{content:"\f1f3"}
500 | .fa-cc-paypal:before{content:"\f1f4"}
501 | .fa-cc-stripe:before{content:"\f1f5"}
502 | .fa-bell-slash:before{content:"\f1f6"}
503 | .fa-bell-slash-o:before{content:"\f1f7"}
504 | .fa-trash:before{content:"\f1f8"}
505 | .fa-copyright:before{content:"\f1f9"}
506 | .fa-at:before{content:"\f1fa"}
507 | .fa-eyedropper:before{content:"\f1fb"}
508 | .fa-paint-brush:before{content:"\f1fc"}
509 | .fa-birthday-cake:before{content:"\f1fd"}
510 | .fa-area-chart:before{content:"\f1fe"}
511 | .fa-pie-chart:before{content:"\f200"}
512 | .fa-line-chart:before{content:"\f201"}
513 | .fa-lastfm:before{content:"\f202"}
514 | .fa-lastfm-square:before{content:"\f203"}
515 | .fa-toggle-off:before{content:"\f204"}
516 | .fa-toggle-on:before{content:"\f205"}
517 | .fa-bicycle:before{content:"\f206"}
518 | .fa-bus:before{content:"\f207"}
519 | .fa-ioxhost:before{content:"\f208"}
520 | .fa-angellist:before{content:"\f209"}
521 | .fa-cc:before{content:"\f20a"}
522 | .fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:"\f20b"}
523 | .fa-meanpath:before{content:"\f20c"}
524 | .fa-buysellads:before{content:"\f20d"}
525 | .fa-connectdevelop:before{content:"\f20e"}
526 | .fa-dashcube:before{content:"\f210"}
527 | .fa-forumbee:before{content:"\f211"}
528 | .fa-leanpub:before{content:"\f212"}
529 | .fa-sellsy:before{content:"\f213"}
530 | .fa-shirtsinbulk:before{content:"\f214"}
531 | .fa-simplybuilt:before{content:"\f215"}
532 | .fa-skyatlas:before{content:"\f216"}
533 | .fa-cart-plus:before{content:"\f217"}
534 | .fa-cart-arrow-down:before{content:"\f218"}
535 | .fa-diamond:before{content:"\f219"}
536 | .fa-ship:before{content:"\f21a"}
537 | .fa-user-secret:before{content:"\f21b"}
538 | .fa-motorcycle:before{content:"\f21c"}
539 | .fa-street-view:before{content:"\f21d"}
540 | .fa-heartbeat:before{content:"\f21e"}
541 | .fa-venus:before{content:"\f221"}
542 | .fa-mars:before{content:"\f222"}
543 | .fa-mercury:before{content:"\f223"}
544 | .fa-intersex:before,.fa-transgender:before{content:"\f224"}
545 | .fa-transgender-alt:before{content:"\f225"}
546 | .fa-venus-double:before{content:"\f226"}
547 | .fa-mars-double:before{content:"\f227"}
548 | .fa-venus-mars:before{content:"\f228"}
549 | .fa-mars-stroke:before{content:"\f229"}
550 | .fa-mars-stroke-v:before{content:"\f22a"}
551 | .fa-mars-stroke-h:before{content:"\f22b"}
552 | .fa-neuter:before{content:"\f22c"}
553 | .fa-genderless:before{content:"\f22d"}
554 | .fa-facebook-official:before{content:"\f230"}
555 | .fa-pinterest-p:before{content:"\f231"}
556 | .fa-whatsapp:before{content:"\f232"}
557 | .fa-server:before{content:"\f233"}
558 | .fa-user-plus:before{content:"\f234"}
559 | .fa-user-times:before{content:"\f235"}
560 | .fa-bed:before,.fa-hotel:before{content:"\f236"}
561 | .fa-viacoin:before{content:"\f237"}
562 | .fa-train:before{content:"\f238"}
563 | .fa-subway:before{content:"\f239"}
564 | .fa-medium:before{content:"\f23a"}
565 | .fa-y-combinator:before,.fa-yc:before{content:"\f23b"}
566 | .fa-optin-monster:before{content:"\f23c"}
567 | .fa-opencart:before{content:"\f23d"}
568 | .fa-expeditedssl:before{content:"\f23e"}
569 | .fa-battery-4:before,.fa-battery-full:before{content:"\f240"}
570 | .fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}
571 | .fa-battery-2:before,.fa-battery-half:before{content:"\f242"}
572 | .fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}
573 | .fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}
574 | .fa-mouse-pointer:before{content:"\f245"}
575 | .fa-i-cursor:before{content:"\f246"}
576 | .fa-object-group:before{content:"\f247"}
577 | .fa-object-ungroup:before{content:"\f248"}
578 | .fa-sticky-note:before{content:"\f249"}
579 | .fa-sticky-note-o:before{content:"\f24a"}
580 | .fa-cc-jcb:before{content:"\f24b"}
581 | .fa-cc-diners-club:before{content:"\f24c"}
582 | .fa-clone:before{content:"\f24d"}
583 | .fa-balance-scale:before{content:"\f24e"}
584 | .fa-hourglass-o:before{content:"\f250"}
585 | .fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}
586 | .fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}
587 | .fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}
588 | .fa-hourglass:before{content:"\f254"}
589 | .fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}
590 | .fa-hand-paper-o:before,.fa-hand-stop-o:before{content:"\f256"}
591 | .fa-hand-scissors-o:before{content:"\f257"}
592 | .fa-hand-lizard-o:before{content:"\f258"}
593 | .fa-hand-spock-o:before{content:"\f259"}
594 | .fa-hand-pointer-o:before{content:"\f25a"}
595 | .fa-hand-peace-o:before{content:"\f25b"}
596 | .fa-trademark:before{content:"\f25c"}
597 | .fa-registered:before{content:"\f25d"}
598 | .fa-creative-commons:before{content:"\f25e"}
599 | .fa-gg:before{content:"\f260"}
600 | .fa-gg-circle:before{content:"\f261"}
601 | .fa-tripadvisor:before{content:"\f262"}
602 | .fa-odnoklassniki:before{content:"\f263"}
603 | .fa-odnoklassniki-square:before{content:"\f264"}
604 | .fa-get-pocket:before{content:"\f265"}
605 | .fa-wikipedia-w:before{content:"\f266"}
606 | .fa-safari:before{content:"\f267"}
607 | .fa-chrome:before{content:"\f268"}
608 | .fa-firefox:before{content:"\f269"}
609 | .fa-opera:before{content:"\f26a"}
610 | .fa-internet-explorer:before{content:"\f26b"}
611 | .fa-television:before,.fa-tv:before{content:"\f26c"}
612 | .fa-contao:before{content:"\f26d"}
613 | .fa-500px:before{content:"\f26e"}
614 | .fa-amazon:before{content:"\f270"}
615 | .fa-calendar-plus-o:before{content:"\f271"}
616 | .fa-calendar-minus-o:before{content:"\f272"}
617 | .fa-calendar-times-o:before{content:"\f273"}
618 | .fa-calendar-check-o:before{content:"\f274"}
619 | .fa-industry:before{content:"\f275"}
620 | .fa-map-pin:before{content:"\f276"}
621 | .fa-map-signs:before{content:"\f277"}
622 | .fa-map-o:before{content:"\f278"}
623 | .fa-map:before{content:"\f279"}
624 | .fa-commenting:before{content:"\f27a"}
625 | .fa-commenting-o:before{content:"\f27b"}
626 | .fa-houzz:before{content:"\f27c"}
627 | .fa-vimeo:before{content:"\f27d"}
628 | .fa-black-tie:before{content:"\f27e"}
629 | .fa-fonticons:before{content:"\f280"}
630 | .fa-reddit-alien:before{content:"\f281"}
631 | .fa-edge:before{content:"\f282"}
632 | .fa-credit-card-alt:before{content:"\f283"}
633 | .fa-codiepie:before{content:"\f284"}
634 | .fa-modx:before{content:"\f285"}
635 | .fa-fort-awesome:before{content:"\f286"}
636 | .fa-usb:before{content:"\f287"}
637 | .fa-product-hunt:before{content:"\f288"}
638 | .fa-mixcloud:before{content:"\f289"}
639 | .fa-scribd:before{content:"\f28a"}
640 | .fa-pause-circle:before{content:"\f28b"}
641 | .fa-pause-circle-o:before{content:"\f28c"}
642 | .fa-stop-circle:before{content:"\f28d"}
643 | .fa-stop-circle-o:before{content:"\f28e"}
644 | .fa-shopping-bag:before{content:"\f290"}
645 | .fa-shopping-basket:before{content:"\f291"}
646 | .fa-hashtag:before{content:"\f292"}
647 | .fa-bluetooth:before{content:"\f293"}
648 | .fa-bluetooth-b:before{content:"\f294"}
649 | .fa-percent:before{content:"\f295"}
650 | .fa-gitlab:before{content:"\f296"}
651 | .fa-wpbeginner:before{content:"\f297"}
652 | .fa-wpforms:before{content:"\f298"}
653 | .fa-envira:before{content:"\f299"}
654 | .fa-universal-access:before{content:"\f29a"}
655 | .fa-wheelchair-alt:before{content:"\f29b"}
656 | .fa-question-circle-o:before{content:"\f29c"}
657 | .fa-blind:before{content:"\f29d"}
658 | .fa-audio-description:before{content:"\f29e"}
659 | .fa-volume-control-phone:before{content:"\f2a0"}
660 | .fa-braille:before{content:"\f2a1"}
661 | .fa-assistive-listening-systems:before{content:"\f2a2"}
662 | .fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before{content:"\f2a3"}
663 | .fa-deaf:before,.fa-deafness:before,.fa-hard-of-hearing:before{content:"\f2a4"}
664 | .fa-glide:before{content:"\f2a5"}
665 | .fa-glide-g:before{content:"\f2a6"}
666 | .fa-sign-language:before,.fa-signing:before{content:"\f2a7"}
667 | .fa-low-vision:before{content:"\f2a8"}
668 | .fa-viadeo:before{content:"\f2a9"}
669 | .fa-viadeo-square:before{content:"\f2aa"}
670 | .fa-snapchat:before{content:"\f2ab"}
671 | .fa-snapchat-ghost:before{content:"\f2ac"}
672 | .fa-snapchat-square:before{content:"\f2ad"}
673 | .fa-pied-piper:before{content:"\f2ae"}
674 | .fa-first-order:before{content:"\f2b0"}
675 | .fa-yoast:before{content:"\f2b1"}
676 | .fa-themeisle:before{content:"\f2b2"}
677 | .fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}
678 | .fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}
679 | .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
680 | .sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}
681 | /*!
682 | * Preboot v2
683 | *
684 | * Open sourced under MIT license by @mdo.
685 | * Some variables and mixins from Bootstrap (Apache 2 license).
686 | */
687 | .book-langs-index{width:100%;height:100%;padding:40px 0;margin:0;overflow:auto}
688 | @media (max-width:600px){.book-langs-index{padding:0}}
689 | .book-langs-index .inner{max-width:600px;width:100%;margin:0 auto;padding:30px;background:#fff;border-radius:3px}
690 | .book-langs-index .inner h3{margin:0}
691 | .book-langs-index .inner .languages{list-style:none;padding:20px 30px;margin-top:20px;border-top:1px solid #eee}
692 | .book-langs-index .inner .languages:after,.book-langs-index .inner .languages:before{content:" ";display:table;line-height:0}
693 | .book-langs-index .inner .languages:after{clear:both}
694 | .book-langs-index .inner .languages li{width:50%;float:left;padding:10px 5px;font-size:16px}
695 | @media (max-width:600px){.book-langs-index .inner .languages li{width:100%;max-width:100%}}.book-header{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;overflow:visible;height:50px;padding:0 8px;z-index:2;font-size:.85em;color:#7e888b;background:0 0}.book-header .btn{display:block;height:50px;padding:0 15px;border-bottom:none;color:#ccc;text-transform:uppercase;line-height:50px;-webkit-box-shadow:none!important;box-shadow:none!important;position:relative;font-size:14px}.book-header .btn:hover{position:relative;text-decoration:none;color:#444;background:0 0}.book-header .btn:focus{outline:0}.book-header h1{margin:0;font-size:20px;font-weight:200;text-align:center;line-height:50px;opacity:0;-webkit-transition:opacity ease .4s;-moz-transition:opacity ease .4s;-o-transition:opacity ease .4s;transition:opacity ease .4s;padding-left:200px;padding-right:200px;-webkit-transition:opacity .2s ease;-moz-transition:opacity .2s ease;-o-transition:opacity .2s ease;transition:opacity .2s ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.book-header h1 a,.book-header h1 a:hover{color:inherit;text-decoration:none}@media (max-width:1000px){.book-header h1{display:none}}.book-header h1 i{display:none}.book-header:hover h1{opacity:1}.book.is-loading .book-header h1 i{display:inline-block}.book.is-loading .book-header h1 a{display:none}.dropdown{position:relative}.dropdown-menu{position:absolute;top:100%;left:0;z-index:100;display:none;float:left;min-width:160px;padding:0;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fafafa;border:1px solid rgba(0,0,0,.07);border-radius:1px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu.open{display:block}.dropdown-menu.dropdown-left{left:auto;right:4%}.dropdown-menu.dropdown-left .dropdown-caret{right:14px;left:auto}.dropdown-menu .dropdown-caret{position:absolute;top:-8px;left:14px;width:18px;height:10px;float:left;overflow:hidden}.dropdown-menu .dropdown-caret .caret-outer{position:absolute;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:9px solid rgba(0,0,0,.1);height:auto;left:0;top:0;width:auto;display:inline-block;margin-left:-1px}.dropdown-menu .dropdown-caret .caret-inner{position:absolute;display:inline-block;margin-top:-1px;top:0;top:1px;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:9px solid #fafafa}.dropdown-menu .buttons{border-bottom:1px solid rgba(0,0,0,.07)}.dropdown-menu .buttons:after,.dropdown-menu .buttons:before{content:" ";display:table;line-height:0}.dropdown-menu .buttons:after{clear:both}.dropdown-menu .buttons:last-child{border-bottom:none}.dropdown-menu .buttons .button{border:0;background-color:transparent;color:#a6a6a6;width:100%;text-align:center;float:left;line-height:1.42857143;padding:8px 4px}.dropdown-menu .buttons .button:hover{color:#444}.dropdown-menu .buttons .button:focus,.dropdown-menu .buttons .button:hover{outline:0}.dropdown-menu .buttons .button.size-2{width:50%}.dropdown-menu .buttons .button.size-3{width:33%}
696 | .book-summary{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:absolute;top:0;left:-300px;bottom:0;z-index:1;overflow-y:auto;width:300px;color:#364149;background:#fafafa;border-right:1px solid rgba(0,0,0,.07);-webkit-transition:left 250ms ease;-moz-transition:left 250ms ease;-o-transition:left 250ms ease;transition:left 250ms ease}
697 | .book-summary nav.summary h1{display:none;}
698 | .book-summary nav.summary ul{list-style:none;margin:0;padding:0;-webkit-transition:top .5s ease;-moz-transition:top .5s ease;-o-transition:top .5s ease;transition:top .5s ease}
699 | .book-summary nav.summary ul li{list-style:none}
700 | .book-summary nav.summary ul li.header{padding:10px 15px;padding-top:20px;text-transform:uppercase;color:#939da3}
701 | .book-summary nav.summary ul li.divider{height:1px;margin:7px 0;overflow:hidden;background:rgba(0,0,0,.07)}
702 | .book-summary nav.summary ul li i.fa-check{display:none;position:absolute;right:9px;top:16px;font-size:9px;color:#3c3}
703 | .book-summary nav.summary ul li.done>a{color:#364149;font-weight:400}
704 | .book-summary nav.summary ul li.done>a i{display:inline}
705 | .book-summary nav.summary ul li a,.book-summary nav.summary ul li span{display:block;padding:10px 15px;border-bottom:none;color:#364149;background:0 0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;position:relative}
706 | .book-summary nav.summary ul li a:hover{text-decoration:underline}
707 | .book-summary nav.summary ul li a:focus{outline:0}
708 | .book-summary nav.summary ul li.active>a{color:#008cff;background:0 0;text-decoration:none}
709 | .book-summary nav.summary ul li ul{padding-left:20px}
710 | @media (max-width:600px){.book-summary{width:calc(100% - 60px);bottom:0;left:-100%}
711 | }
712 | .book.with-summary .book-summary{left:0}
713 | .book.without-animation .book-summary{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}
714 | .book{position:relative;width:100%;height:100%}
715 | @media (min-width:600px){.book.with-summary .book-body{left:300px}
716 | }
717 | @media (max-width:600px){.book.with-summary{overflow:hidden}
718 | .book.with-summary .book-body{-webkit-transform:translate(calc(100% - 60px),0);-moz-transform:translate(calc(100% - 60px),0);-ms-transform:translate(calc(100% - 60px),0);-o-transform:translate(calc(100% - 60px),0);transform:translate(calc(100% - 60px),0)}
719 | }
720 | .book.without-animation .book-body{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}
721 | .book-body{position:absolute;top:0;right:0;left:0;bottom:0;overflow-y:auto;color:#000;background:#fff;-webkit-transition:left 250ms ease;-moz-transition:left 250ms ease;-o-transition:left 250ms ease;transition:left 250ms ease}
722 | .book-body .body-inner{position:absolute;top:0;right:0;left:0;bottom:0;overflow-y:auto}
723 | @media (max-width:1240px){.book-body{-webkit-transition:-webkit-transform 250ms ease;-moz-transition:-moz-transform 250ms ease;-o-transition:-o-transform 250ms ease;transition:transform 250ms ease;padding-bottom:20px}
724 | .book-body .body-inner{position:static;min-height:calc(100% - 50px)}
725 | }
726 | .page-wrapper{position:relative;outline:0}
727 | .page-inner{position:relative;max-width:800px;margin:0 auto;padding:20px 15px 40px 15px}
728 | .page-inner .btn-group .btn{border-radius:0;background:#eee;border:0}
729 | .buttons:after,.buttons:before{content:" ";display:table;line-height:0}
730 | .buttons:after{clear:both}
731 | .button{border:0;background-color:transparent;background:#eee;color:#666;width:100%;text-align:center;float:left;line-height:1.42857143;padding:8px 4px}
732 | .button:hover{color:#444}
733 | .button:focus,.button:hover{outline:0}
734 | .button.size-2{width:50%}
735 | .button.size-3{width:33%}
736 | .markdown-section{display:block;word-wrap:break-word;overflow:hidden;color:#333;line-height:1.7;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%}
737 | .markdown-section *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}
738 | .markdown-section>:first-child{margin-top:0!important}
739 | .markdown-section>:last-child{margin-bottom:0!important}
740 | .markdown-section blockquote,.markdown-section code,.markdown-section figure,.markdown-section img,.markdown-section pre,.markdown-section table,.markdown-section tr{page-break-inside:avoid}
741 | .markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section h5,.markdown-section p{orphans:3;widows:3}
742 | .markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section h5{page-break-after:avoid}
743 | .markdown-section b,.markdown-section strong{font-weight:700}
744 | .markdown-section em{font-style:italic}
745 | .markdown-section blockquote,.markdown-section dl,.markdown-section ol,.markdown-section p,.markdown-section table,.markdown-section ul{margin-top:0;margin-bottom:.85em}
746 | .markdown-section a{color:#4183c4;text-decoration:none;background:0 0}
747 | .markdown-section a:active,.markdown-section a:focus,.markdown-section a:hover{outline:0;text-decoration:underline}
748 | .markdown-section img{border:0;max-width:100%}
749 | .markdown-section hr{height:4px;padding:0;margin:1.7em 0;overflow:hidden;background-color:#e7e7e7;border:none}
750 | .markdown-section hr:after,.markdown-section hr:before{display:table;content:" "}
751 | .markdown-section hr:after{clear:both}
752 | .markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section h5,.markdown-section h6{margin-top:1.275em;margin-bottom:.85em;font-weight:700}
753 | .markdown-section h1{font-size:2em}
754 | .markdown-section h2{font-size:1.75em}
755 | .markdown-section h3{font-size:1.5em}
756 | .markdown-section h4{font-size:1.25em}
757 | .markdown-section h5{font-size:1em}
758 | .markdown-section h6{font-size:1em;color:#777}
759 | .markdown-section code,.markdown-section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;margin:0;padding:0;border:none;color:inherit}
760 | .markdown-section pre{overflow:auto;word-wrap:normal;margin:0;padding:.85em 1em;margin-bottom:1.275em;background:#f7f7f7}
761 | .markdown-section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}
762 | .markdown-section pre>code:after,.markdown-section pre>code:before{content:normal}
763 | .markdown-section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}
764 | .markdown-section code:after,.markdown-section code:before{letter-spacing:-.2em;content:"\00a0"}
765 | .markdown-section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}
766 | .markdown-section table td,.markdown-section table th{padding:6px 13px;border:1px solid #ddd}
767 | .markdown-section table tr{background-color:#fff;border-top:1px solid #ccc}
768 | .markdown-section table tr:nth-child(2n){background-color:#f8f8f8}
769 | .markdown-section table th{font-weight:700}
770 | .markdown-section ol,.markdown-section ul{padding:0;margin:0;margin-bottom:.85em;padding-left:2em}
771 | .markdown-section ol ol,.markdown-section ol ul,.markdown-section ul ol,.markdown-section ul ul{margin-top:0;margin-bottom:0}
772 | .markdown-section ol ol{list-style-type:lower-roman}
773 | .markdown-section blockquote{margin:0;margin-bottom:.85em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}
774 | .markdown-section blockquote:first-child{margin-top:0}
775 | .markdown-section blockquote:last-child{margin-bottom:0}
776 | .markdown-section dl{padding:0}
777 | .markdown-section dl dt{padding:0;margin-top:.85em;font-style:italic;font-weight:700}
778 | .markdown-section dl dd{padding:0 .85em;margin-bottom:.85em}
779 | .markdown-section dd{margin-left:0}
780 | .markdown-section .glossary-term{cursor:help;text-decoration:underline}
781 | .navigation{position:absolute;top:50px;bottom:0;margin:0;max-width:150px;min-width:90px;display:flex;justify-content:center;align-content:center;flex-direction:column;font-size:40px;color:#ccc;text-align:center;-webkit-transition:all 350ms ease;-moz-transition:all 350ms ease;-o-transition:all 350ms ease;transition:all 350ms ease}
782 | .navigation:hover{text-decoration:none;color:#444}
783 | .navigation.navigation-next{right:0}
784 | .navigation.navigation-prev{left:0}
785 | @media (max-width:1240px){.navigation{position:static;top:auto;max-width:50%;width:50%;display:inline-block;float:left}
786 | .navigation.navigation-unique{max-width:100%;width:100%}
787 | }
788 | #book-search-input{padding:6px;background:0 0;transition:top .5s ease;background:#fff;border-bottom:1px solid rgba(0,0,0,.07);border-top:1px solid rgba(0,0,0,.07);margin-bottom:10px;margin-top:-1px}
789 | #book-search-input input,#book-search-input input:focus,#book-search-input input:hover{width:100%;background:0 0;border:1px solid transparent;box-shadow:none;outline:0;line-height:22px;padding:7px 7px;color:inherit}
790 | #book-search-results{opacity:1}
791 | #book-search-results .search-results .search-results-title{text-transform:uppercase;text-align:center;font-weight:200;margin-bottom:35px;opacity:.6}
792 | #book-search-results .search-results .has-results .search-results-item{display:block;word-wrap:break-word;overflow:hidden;color:#333;line-height:1.7;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%}
793 | #book-search-results .search-results .has-results .search-results-item *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}
794 | #book-search-results .search-results .has-results .search-results-item>:first-child{margin-top:0!important}
795 | #book-search-results .search-results .has-results .search-results-item>:last-child{margin-bottom:0!important}
796 | #book-search-results .search-results .has-results .search-results-item blockquote,#book-search-results .search-results .has-results .search-results-item code,#book-search-results .search-results .has-results .search-results-item figure,#book-search-results .search-results .has-results .search-results-item img,#book-search-results .search-results .has-results .search-results-item pre,#book-search-results .search-results .has-results .search-results-item table,#book-search-results .search-results .has-results .search-results-item tr{page-break-inside:avoid}
797 | #book-search-results .search-results .has-results .search-results-item h2,#book-search-results .search-results .has-results .search-results-item h3,#book-search-results .search-results .has-results .search-results-item h4,#book-search-results .search-results .has-results .search-results-item h5,#book-search-results .search-results .has-results .search-results-item p{orphans:3;widows:3}
798 | #book-search-results .search-results .has-results .search-results-item h1,#book-search-results .search-results .has-results .search-results-item h2,#book-search-results .search-results .has-results .search-results-item h3,#book-search-results .search-results .has-results .search-results-item h4,#book-search-results .search-results .has-results .search-results-item h5{page-break-after:avoid}
799 | #book-search-results .search-results .has-results .search-results-item b,#book-search-results .search-results .has-results .search-results-item strong{font-weight:700}
800 | #book-search-results .search-results .has-results .search-results-item em{font-style:italic}
801 | #book-search-results .search-results .has-results .search-results-item blockquote,#book-search-results .search-results .has-results .search-results-item dl,#book-search-results .search-results .has-results .search-results-item ol,#book-search-results .search-results .has-results .search-results-item p,#book-search-results .search-results .has-results .search-results-item table,#book-search-results .search-results .has-results .search-results-item ul{margin-top:0;margin-bottom:.85em}
802 | #book-search-results .search-results .has-results .search-results-item a{color:#4183c4;text-decoration:none;background:0 0}
803 | #book-search-results .search-results .has-results .search-results-item a:active,#book-search-results .search-results .has-results .search-results-item a:focus,#book-search-results .search-results .has-results .search-results-item a:hover{outline:0;text-decoration:underline}
804 | #book-search-results .search-results .has-results .search-results-item img{border:0;max-width:100%}
805 | #book-search-results .search-results .has-results .search-results-item hr{height:4px;padding:0;margin:1.7em 0;overflow:hidden;background-color:#e7e7e7;border:none}
806 | #book-search-results .search-results .has-results .search-results-item hr:after,#book-search-results .search-results .has-results .search-results-item hr:before{display:table;content:" "}
807 | #book-search-results .search-results .has-results .search-results-item hr:after{clear:both}
808 | #book-search-results .search-results .has-results .search-results-item h1,#book-search-results .search-results .has-results .search-results-item h2,#book-search-results .search-results .has-results .search-results-item h3,#book-search-results .search-results .has-results .search-results-item h4,#book-search-results .search-results .has-results .search-results-item h5,#book-search-results .search-results .has-results .search-results-item h6{margin-top:1.275em;margin-bottom:.85em;font-weight:700}
809 | #book-search-results .search-results .has-results .search-results-item h1{font-size:2em}
810 | #book-search-results .search-results .has-results .search-results-item h2{font-size:1.75em}
811 | #book-search-results .search-results .has-results .search-results-item h3{font-size:1.5em}
812 | #book-search-results .search-results .has-results .search-results-item h4{font-size:1.25em}
813 | #book-search-results .search-results .has-results .search-results-item h5{font-size:1em}
814 | #book-search-results .search-results .has-results .search-results-item h6{font-size:1em;color:#777}
815 | #book-search-results .search-results .has-results .search-results-item code,#book-search-results .search-results .has-results .search-results-item pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;margin:0;padding:0;border:none;color:inherit}
816 | #book-search-results .search-results .has-results .search-results-item pre{overflow:auto;word-wrap:normal;margin:0;padding:.85em 1em;margin-bottom:1.275em;background:#f7f7f7}
817 | #book-search-results .search-results .has-results .search-results-item pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}
818 | #book-search-results .search-results .has-results .search-results-item pre>code:after,#book-search-results .search-results .has-results .search-results-item pre>code:before{content:normal}
819 | #book-search-results .search-results .has-results .search-results-item code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}
820 | #book-search-results .search-results .has-results .search-results-item code:after,#book-search-results .search-results .has-results .search-results-item code:before{letter-spacing:-.2em;content:"\00a0"}
821 | #book-search-results .search-results .has-results .search-results-item table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}
822 | #book-search-results .search-results .has-results .search-results-item table td,#book-search-results .search-results .has-results .search-results-item table th{padding:6px 13px;border:1px solid #ddd}
823 | #book-search-results .search-results .has-results .search-results-item table tr{background-color:#fff;border-top:1px solid #ccc}
824 | #book-search-results .search-results .has-results .search-results-item table tr:nth-child(2n){background-color:#f8f8f8}
825 | #book-search-results .search-results .has-results .search-results-item table th{font-weight:700}
826 | #book-search-results .search-results .has-results .search-results-item ol,#book-search-results .search-results .has-results .search-results-item ul{padding:0;margin:0;margin-bottom:.85em;padding-left:2em}
827 | #book-search-results .search-results .has-results .search-results-item ol ol,#book-search-results .search-results .has-results .search-results-item ol ul,#book-search-results .search-results .has-results .search-results-item ul ol,#book-search-results .search-results .has-results .search-results-item ul ul{margin-top:0;margin-bottom:0}
828 | #book-search-results .search-results .has-results .search-results-item ol ol{list-style-type:lower-roman}
829 | #book-search-results .search-results .has-results .search-results-item blockquote{margin:0;margin-bottom:.85em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}
830 | #book-search-results .search-results .has-results .search-results-item blockquote:first-child{margin-top:0}
831 | #book-search-results .search-results .has-results .search-results-item blockquote:last-child{margin-bottom:0}
832 | #book-search-results .search-results .has-results .search-results-item dl{padding:0}
833 | #book-search-results .search-results .has-results .search-results-item dl dt{padding:0;margin-top:.85em;font-style:italic;font-weight:700}
834 | #book-search-results .search-results .has-results .search-results-item dl dd{padding:0 .85em;margin-bottom:.85em}
835 | #book-search-results .search-results .has-results .search-results-item dd{margin-left:0}
836 | #book-search-results .search-results .has-results .search-results-item h3{margin-top:0;margin-bottom:0}
837 | #book-search-results .search-results .no-results{padding:40px 0}
838 | body.search-loading #book-search-results{opacity:.3}
839 | body.with-search .navigation{display:none}
840 | *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:none;-webkit-touch-callout:none;-webkit-font-smoothing:antialiased}
841 | a{text-decoration:none}
842 | body,html{height:100%}
843 | html{font-size:62.5%}
844 | body{text-rendering:optimizeLegibility;font-smoothing:antialiased;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:.2px;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
845 |
846 | /*
847 | This CSS only styled the search results section, not the search input
848 | It defines the basic interraction to hide content when displaying results, etc
849 | */
850 | #book-search-results .search-results {
851 | display: none;
852 | }
853 | #book-search-results .search-results ul.search-results-list {
854 | list-style-type: none;
855 | padding-left: 0;
856 | }
857 | #book-search-results .search-results ul.search-results-list li {
858 | margin-bottom: 1.5rem;
859 | padding-bottom: 0.5rem;
860 | /* Highlight results */
861 | }
862 | #book-search-results .search-results ul.search-results-list li p em {
863 | background-color: rgba(255, 220, 0, 0.4);
864 | font-style: normal;
865 | }
866 | #book-search-results .search-results .no-results {
867 | display: none;
868 | }
869 | #book-search-results.open .search-results {
870 | display: block;
871 | }
872 | #book-search-results.open .search-noresults {
873 | display: none;
874 | }
875 | #book-search-results.no-results .search-results .has-results {
876 | display: none;
877 | }
878 | #book-search-results.no-results .search-results .no-results {
879 | display: block;
880 | }
881 |
--------------------------------------------------------------------------------
/book/gitbook/website.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Theme 1
3 | */
4 | .color-theme-1 .dropdown-menu {
5 | background-color: #111111;
6 | border-color: #7e888b;
7 | }
8 | .color-theme-1 .dropdown-menu .dropdown-caret .caret-inner {
9 | border-bottom: 9px solid #111111;
10 | }
11 | .color-theme-1 .dropdown-menu .buttons {
12 | border-color: #7e888b;
13 | }
14 | .color-theme-1 .dropdown-menu .button {
15 | color: #afa790;
16 | }
17 | .color-theme-1 .dropdown-menu .button:hover {
18 | color: #73553c;
19 | }
20 | /*
21 | * Theme 2
22 | */
23 | .color-theme-2 .dropdown-menu {
24 | background-color: #2d3143;
25 | border-color: #272a3a;
26 | }
27 | .color-theme-2 .dropdown-menu .dropdown-caret .caret-inner {
28 | border-bottom: 9px solid #2d3143;
29 | }
30 | .color-theme-2 .dropdown-menu .buttons {
31 | border-color: #272a3a;
32 | }
33 | .color-theme-2 .dropdown-menu .button {
34 | color: #62677f;
35 | }
36 | .color-theme-2 .dropdown-menu .button:hover {
37 | color: #f4f4f5;
38 | }
39 | .book .book-header .font-settings .font-enlarge {
40 | line-height: 30px;
41 | font-size: 1.4em;
42 | }
43 | .book .book-header .font-settings .font-reduce {
44 | line-height: 30px;
45 | font-size: 1em;
46 | }
47 | .book.color-theme-1 .book-body {
48 | color: #704214;
49 | background: #f3eacb;
50 | }
51 | .book.color-theme-1 .book-body .page-wrapper .page-inner section {
52 | background: #f3eacb;
53 | }
54 | .book.color-theme-2 .book-body {
55 | color: #bdcadb;
56 | background: #1c1f2b;
57 | }
58 | .book.color-theme-2 .book-body .page-wrapper .page-inner section {
59 | background: #1c1f2b;
60 | }
61 | .book.font-size-0 .book-body .page-inner section {
62 | font-size: 1.2rem;
63 | }
64 | .book.font-size-1 .book-body .page-inner section {
65 | font-size: 1.4rem;
66 | }
67 | .book.font-size-2 .book-body .page-inner section {
68 | font-size: 1.6rem;
69 | }
70 | .book.font-size-3 .book-body .page-inner section {
71 | font-size: 2.2rem;
72 | }
73 | .book.font-size-4 .book-body .page-inner section {
74 | font-size: 4rem;
75 | }
76 | .book.font-family-0 {
77 | font-family: Georgia, serif;
78 | }
79 | .book.font-family-1 {
80 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
81 | }
82 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal {
83 | color: #704214;
84 | }
85 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a {
86 | color: inherit;
87 | }
88 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
89 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2,
90 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3,
91 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4,
92 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5,
93 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
94 | color: inherit;
95 | }
96 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
97 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 {
98 | border-color: inherit;
99 | }
100 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
101 | color: inherit;
102 | }
103 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr {
104 | background-color: inherit;
105 | }
106 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote {
107 | border-color: inherit;
108 | }
109 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre,
110 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code {
111 | background: #fdf6e3;
112 | color: #657b83;
113 | border-color: #f8df9c;
114 | }
115 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight {
116 | background-color: inherit;
117 | }
118 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th,
119 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td {
120 | border-color: #f5d06c;
121 | }
122 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr {
123 | color: inherit;
124 | background-color: #fdf6e3;
125 | border-color: #444444;
126 | }
127 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
128 | background-color: #fbeecb;
129 | }
130 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal {
131 | color: #bdcadb;
132 | }
133 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a {
134 | color: #3eb1d0;
135 | }
136 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
137 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2,
138 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3,
139 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4,
140 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5,
141 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
142 | color: #fffffa;
143 | }
144 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
145 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 {
146 | border-color: #373b4e;
147 | }
148 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
149 | color: #373b4e;
150 | }
151 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr {
152 | background-color: #373b4e;
153 | }
154 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote {
155 | border-color: #373b4e;
156 | }
157 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre,
158 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code {
159 | color: #9dbed8;
160 | background: #2d3143;
161 | border-color: #2d3143;
162 | }
163 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight {
164 | background-color: #282a39;
165 | }
166 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th,
167 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td {
168 | border-color: #3b3f54;
169 | }
170 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr {
171 | color: #b6c2d2;
172 | background-color: #2d3143;
173 | border-color: #3b3f54;
174 | }
175 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
176 | background-color: #35394b;
177 | }
178 | .book.color-theme-1 .book-header {
179 | color: #afa790;
180 | background: transparent;
181 | }
182 | .book.color-theme-1 .book-header .btn {
183 | color: #afa790;
184 | }
185 | .book.color-theme-1 .book-header .btn:hover {
186 | color: #73553c;
187 | background: none;
188 | }
189 | .book.color-theme-1 .book-header h1 {
190 | color: #704214;
191 | }
192 | .book.color-theme-2 .book-header {
193 | color: #7e888b;
194 | background: transparent;
195 | }
196 | .book.color-theme-2 .book-header .btn {
197 | color: #3b3f54;
198 | }
199 | .book.color-theme-2 .book-header .btn:hover {
200 | color: #fffff5;
201 | background: none;
202 | }
203 | .book.color-theme-2 .book-header h1 {
204 | color: #bdcadb;
205 | }
206 | .book.color-theme-1 .book-body .navigation {
207 | color: #afa790;
208 | }
209 | .book.color-theme-1 .book-body .navigation:hover {
210 | color: #73553c;
211 | }
212 | .book.color-theme-2 .book-body .navigation {
213 | color: #383f52;
214 | }
215 | .book.color-theme-2 .book-body .navigation:hover {
216 | color: #fffff5;
217 | }
218 | /*
219 | * Theme 1
220 | */
221 | .book.color-theme-1 .book-summary {
222 | color: #afa790;
223 | background: #111111;
224 | border-right: 1px solid rgba(0, 0, 0, 0.07);
225 | }
226 | .book.color-theme-1 .book-summary .book-search {
227 | background: transparent;
228 | }
229 | .book.color-theme-1 .book-summary .book-search input,
230 | .book.color-theme-1 .book-summary .book-search input:focus {
231 | border: 1px solid transparent;
232 | }
233 | .book.color-theme-1 .book-summary ul.summary li.divider {
234 | background: #7e888b;
235 | box-shadow: none;
236 | }
237 | .book.color-theme-1 .book-summary ul.summary li i.fa-check {
238 | color: #33cc33;
239 | }
240 | .book.color-theme-1 .book-summary ul.summary li.done > a {
241 | color: #877f6a;
242 | }
243 | .book.color-theme-1 .book-summary ul.summary li a,
244 | .book.color-theme-1 .book-summary ul.summary li span {
245 | color: #877f6a;
246 | background: transparent;
247 | font-weight: normal;
248 | }
249 | .book.color-theme-1 .book-summary ul.summary li.active > a,
250 | .book.color-theme-1 .book-summary ul.summary li a:hover {
251 | color: #704214;
252 | background: transparent;
253 | font-weight: normal;
254 | }
255 | /*
256 | * Theme 2
257 | */
258 | .book.color-theme-2 .book-summary {
259 | color: #bcc1d2;
260 | background: #2d3143;
261 | border-right: none;
262 | }
263 | .book.color-theme-2 .book-summary .book-search {
264 | background: transparent;
265 | }
266 | .book.color-theme-2 .book-summary .book-search input,
267 | .book.color-theme-2 .book-summary .book-search input:focus {
268 | border: 1px solid transparent;
269 | }
270 | .book.color-theme-2 .book-summary ul.summary li.divider {
271 | background: #272a3a;
272 | box-shadow: none;
273 | }
274 | .book.color-theme-2 .book-summary ul.summary li i.fa-check {
275 | color: #33cc33;
276 | }
277 | .book.color-theme-2 .book-summary ul.summary li.done > a {
278 | color: #62687f;
279 | }
280 | .book.color-theme-2 .book-summary ul.summary li a,
281 | .book.color-theme-2 .book-summary ul.summary li span {
282 | color: #c1c6d7;
283 | background: transparent;
284 | font-weight: 600;
285 | }
286 | .book.color-theme-2 .book-summary ul.summary li.active > a,
287 | .book.color-theme-2 .book-summary ul.summary li a:hover {
288 | color: #f4f4f5;
289 | background: #252737;
290 | font-weight: 600;
291 | }
292 |
--------------------------------------------------------------------------------
/build.sh:
--------------------------------------------------------------------------------
1 | set -x -e
2 | mkdir -p tmp
3 |
4 | # Build navigation
5 | pandoc -f markdown -t html SUMMARY.md | \
6 | sed -e 's|\.md|.html|' -e 's|href="|href="/intro2UnixandSGE/|' > book/SUMMARY.html
7 |
8 | echo '[' > tmp/documents.json
9 |
10 | for file in $(find pages -type f -printf '%P\n'); do
11 | echo $file
12 | title=$(egrep --max-count=1 '^# ' pages/$file | tail -c +3)
13 |
14 | # Build JSON documents for indexing
15 | tr \" \' < pages/$file | tr -d "[:punct:]" | \
16 | pandoc -f gfm \
17 | -t plain \
18 | -V url="/intro2UnixandSGE/$(dirname $file)/$(basename $file .md).html" \
19 | -V pagetitle="$title" \
20 | --template template.json - | tr "\n" " " >> tmp/documents.json
21 |
22 | # Build web pages
23 | mkdir -p book/$(dirname $file)
24 | # TODO: level should be taken from SUMMARY
25 | pandoc -f markdown_github+smart \
26 | -t html \
27 | -V level="1.1" \
28 | -V navigation="$(cat book/SUMMARY.html)" \
29 | -V pagetitle="$title" \
30 | -o "book/$(dirname $file)/$(basename $file .md).html" \
31 | --template template.html pages/$file
32 | done
33 | echo '{}]' >> tmp/documents.json
34 |
35 | cp book/README.html book/index.html
36 | node bake-index.js < tmp/documents.json > book/search_index.json
37 | rm tmp/documents.json
38 |
--------------------------------------------------------------------------------
/manifest.scm:
--------------------------------------------------------------------------------
1 | ;; guix environment -m manifest.scm
2 | (specifications->manifest '("pandoc" "node"))
3 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shell-intro",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "lunr": {
8 | "version": "0.5.12",
9 | "resolved": "https://registry.npmjs.org/lunr/-/lunr-0.5.12.tgz",
10 | "integrity": "sha1-ova314AcvizLFpbaZ/H3eI+J4Mg="
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shell-intro",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "bake-index.js",
6 | "dependencies": {
7 | "lunr": "^0.5.12"
8 | },
9 | "devDependencies": {},
10 | "scripts": {
11 | "test": "echo \"Error: no test specified\" && exit 1"
12 | },
13 | "repository": {
14 | "type": "git",
15 | "url": "git+https://github.com/BIMSBbioinfo/intro2UnixandSGE.git"
16 | },
17 | "author": "",
18 | "license": "gpl3",
19 | "bugs": {
20 | "url": "https://github.com/BIMSBbioinfo/intro2UnixandSGE/issues"
21 | },
22 | "homepage": "https://github.com/BIMSBbioinfo/intro2UnixandSGE"
23 | }
24 |
--------------------------------------------------------------------------------
/pages/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | ## Introduction to Unix and Grid Engine for beginners
4 |
5 | This is a guide on using unix systems and the Grid Engine cluster
6 | environment.
7 |
8 | First chapter will introduce basic usage for unix systems. The second
9 | chapter will explore the Grid Engine environment and show how to use the queuing
10 | system from users perspective.
11 |
12 | ### What will you get out of this ?
13 |
14 | After reading, you will:
15 |
16 | * be able to use unix commands to navigate the file system
17 | * use unix commands to interrogate files
18 | * understand and write basic bash scripts
19 | * understand Grid Engine and queueing system
20 | * be able to submit jobs to a Grid Engine cluster and troubleshoot
21 |
22 | ### Contribute to the development
23 |
24 | You can contribute to the development of this guide using github
25 | features such as pull-requests and issue creation.
26 |
27 |
28 | ### Build the book
29 |
30 | This book is compiled with pandoc.
31 |
32 | Run `guix environment -m manifest.scm` to enter a suitable environment
33 | to hack on this book. Then run `npm install` to install the lunr
34 | JavaScript library for the search index.
35 |
36 |
37 | ### How to update the book
38 |
39 | Edit the .md files using markdown syntax and run **bash
40 | build.sh**. This will regenerate the book and store the files in the
41 | `book` directory. Copy the contents of this directory to the
42 | **gh-pages** branch (the contents of this branch are served by GitHub
43 | pages) and push those changes to **"gh-pages"** branch of the online
44 | repository. You should also commit the changes you made in the
45 | **"master"** branch via `git commit`. Basically, **"master"** branch
46 | has the markdown files, **"gh-pages"** branch has the html website.
47 |
48 |
49 | ### Acknowledgements
50 |
51 | Initially created by Altuna Akalin. Some of the material is based on
52 | Martin Siegert's documentation of the Grid Engine cluster.
53 |
54 |
--------------------------------------------------------------------------------
/pages/downloading_files_with_wget,_curl_and_ftp/README.md:
--------------------------------------------------------------------------------
1 | # Downloading files with wget, curl and ftp
2 | You will often need to download files using the shell interface. There are multiple options on Unix-like systems that will allow you to do that. Below are a few examples.
3 |
4 | ## wget
5 | **wget** can be used to download files from internet and store them. The following command downloads a compressed archive from the web and stores it in the current directory.
6 |
7 | ```
8 | $ wget http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2
9 | ```
10 |
11 | The **-O** option can be used to change the output file name.
12 |
13 | ```
14 | $ wget -O strx25.tar.bz2 http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2
15 | ```
16 |
17 | You can also use `wget` to download a file list using **-i** option and giving a text file containing file URLs. Here is an example:
18 |
19 | ```
20 | $ cat download-file-list.txt
21 | URL1
22 | URL2
23 | URL3
24 | URL4
25 |
26 | $ wget -i download-file-list.txt
27 | ```
28 |
29 | ## curl
30 |
31 |
32 | ## ftp
33 |
--------------------------------------------------------------------------------
/pages/sun_grid_engine_for_beginners/README.md:
--------------------------------------------------------------------------------
1 | # Grid Engine for beginners
2 | Using the Max cluster environment is similar to using GNU/Linux environments for your job submission (e.g running your scripts or other software). The difference is that you need to specify needed resources beforehand. The cluster is controlled by the Grid Engine scheduler that organizes the queues and resources. This sort of scheduling system is necessary when limited computational resources are shared by many. And, it would be useful if you are running alignments for multiple samples and want to distribute those tasks (jobs) across multiple machines or CPUs, or when running statistical simulations that needs to run on multiple CPUs for a long time. For these cases and many more alike, you just need to submit your job script (which is a shell script) and Grid Engine will take care of the rest (as long as there is no error in your script).
3 |
4 | Grid Engine will do the **"job scheduling"**. That means you can submit all your jobs and Grid Engine will queue them and run them when resources you requested becomes available. It will also achieve **"load balancing"** where the jobs will be distributed so that specific nodes do not get overloaded. In addition, Grid Engine will allow you to do **"job monitoring and accounting"** which will be useful when you want to check if your job is running ,and if it failed it will help you understand what went wrong.
5 |
6 |
7 |
8 |
9 | Within the next sections, we will show how to use Grid Engine for **job submission**, **monitoring** and **troubleshooting**.
10 |
--------------------------------------------------------------------------------
/pages/sun_grid_engine_for_beginners/faq.md:
--------------------------------------------------------------------------------
1 | # FAQ
2 |
3 | Some FAQ goes here, we can sample from most asked questions/themes in the help desk mails.
4 |
--------------------------------------------------------------------------------
/pages/sun_grid_engine_for_beginners/how_to_run_array_jobs.md:
--------------------------------------------------------------------------------
1 | # How to run array jobs
2 | Running array jobs goes here, there is some material at bbc already
3 |
--------------------------------------------------------------------------------
/pages/sun_grid_engine_for_beginners/how_to_submit_a_job_using_qsub.md:
--------------------------------------------------------------------------------
1 | # How to submit a job using qsub
2 | `qsub` is a command used for submission to the Grid Engine cluster. In the section 2.1 Quickstart and basics, we showed that you can submit an example job using qsub as follows:
3 | ```
4 | username@max-loginX:~$ qsub -V -b n -cwd runJob.sh
5 | Your job 1 ("runJob.sh") has been submitted
6 | ```
7 | The general syntax of how to use qsub is below.
8 | ```
9 | qsub -q