├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── .npmignore ├── CHECKLIST.md ├── CONTRIBUTING.md ├── HISTORY.md ├── LICENSE.md ├── README.md ├── docpad.js ├── package.json └── src ├── layouts └── default.html.eco ├── render └── index.html └── static ├── lib └── jquery-scrollto.js ├── styles ├── generic.css └── style.css └── vendor ├── github.css ├── jquery.js └── yui-cssreset.css /.editorconfig: -------------------------------------------------------------------------------- 1 | # 2016 March 8 2 | # https://github.com/bevry/base 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = false 10 | insert_final_newline = false 11 | indent_style = tab 12 | 13 | [*.json] 14 | indent_style = space 15 | indent_size = 2 16 | 17 | [*.yml] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | [*.md] 22 | indent_style = space 23 | indent_size = 2 24 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // 2016 September 7 - custom for es5 2 | // https://github.com/bevry/base 3 | // http://eslint.org 4 | // This code must be able to run on Node 0.10 5 | /* eslint no-warning-comments: 0 */ 6 | var IGNORE = 0, WARN = 1, ERROR = 2, MAX_PARAMS = 4 7 | 8 | var config = { 9 | extends: ['eslint:recommended'], 10 | plugins: [], 11 | parserOptions: { 12 | sourceType: 'module', 13 | ecmaVersion: 6, 14 | ecmaFeatures: { 15 | jsx: true 16 | } 17 | }, 18 | env: { 19 | browser: true, 20 | node: true, 21 | es6: true, 22 | commonjs: true, 23 | amd: true 24 | }, 25 | rules: { 26 | // ---------------------------- 27 | // Problems with these rules 28 | // If we can figure out how to enable the following, that would be great 29 | 30 | // Two spaces after one line if or else: 31 | // if ( blah ) return 32 | // Insead of one space: 33 | // if ( blah ) return 34 | 35 | // No spaces on embedded function: 36 | // .forEach(function(key, value){ 37 | // instead of: 38 | // .forEach(function (key, value) { 39 | 40 | // Else and catch statements on the same line as closing brace: 41 | // } else { 42 | // } catch (e) { 43 | // instead of: 44 | // } 45 | // else { 46 | 47 | 48 | // -------------------------------------- 49 | // Possible Errors 50 | // The following rules point out areas where you might have made mistakes. 51 | 52 | // ES6 supports dangling commas 53 | 'comma-dangle': IGNORE, 54 | 55 | // Don't allow assignments in conditional statements (if, while, etc.) 56 | 'no-cond-assign': [ERROR, 'always'], 57 | 58 | // Warn but don't error about console statements 59 | 'no-console': WARN, 60 | 61 | // Allow while(true) loops 62 | 'no-constant-condition': IGNORE, 63 | 64 | // Seems like a good idea to error about this 65 | 'no-control-regex': ERROR, 66 | 67 | // Warn but don't error about console statements 68 | 'no-debugger': WARN, 69 | 70 | // Don't allow duplicate arguments in a function, they can cause errors 71 | 'no-dupe-args': ERROR, 72 | 73 | // Disallow duplicate keys in an object, they can cause errors 74 | 'no-dupe-keys': ERROR, 75 | 76 | // Disallow duplicate case statements in a switch 77 | 'no-duplicate-case': ERROR, 78 | 79 | // Allow empty block statements, they are useful for clarity 80 | 'no-empty': IGNORE, 81 | 82 | // Disallow empty [] in regular expressions as they cause unexpected behaviour 83 | 'no-empty-character-class': ERROR, 84 | 85 | // Overwriting the exception argument in a catch statement can cause memory leaks in some browsers 86 | 'no-ex-assign': ERROR, 87 | 88 | // Disallow superflous boolean casts, they offer no value 89 | 'no-extra-boolean-cast': ERROR, 90 | 91 | // Allow superflous parenthesis as they offer clarity in some cases 92 | 'no-extra-parens': IGNORE, 93 | 94 | // Disallow superflous semicolons, they offer no value 95 | 'no-extra-semi': IGNORE, 96 | 97 | // Seems like a good idea to error about this 98 | 'no-func-assign': ERROR, 99 | 100 | // Seems like a good idea to error about this 101 | 'no-inner-declarations': ERROR, 102 | 103 | // Seems like a good idea to error about this 104 | 'no-invalid-regexp': ERROR, 105 | 106 | // Seems like a good idea to error about this 107 | 'no-irregular-whitespace': ERROR, 108 | 109 | // Seems like a good idea to error about this 110 | 'no-negated-in-lhs': ERROR, 111 | 112 | // Seems like a good idea to error about this 113 | 'no-obj-calls': ERROR, 114 | 115 | // Seems like a good idea to error about this 116 | // Instead of / / used / {ERROR}/ instead 117 | 'no-regex-spaces': ERROR, 118 | 119 | // Seems like a good idea to error about this 120 | 'no-sparse-arrays': ERROR, 121 | 122 | // Seems like a good idea to error about this 123 | 'no-unexpected-multiline': ERROR, 124 | 125 | // Seems like a good idea to error about this 126 | 'no-unreachable': ERROR, 127 | 128 | // Seems like a good idea to error about this 129 | 'use-isnan': ERROR, 130 | 131 | // We use JSDoc again 132 | 'valid-jsdoc': [ERROR, { 133 | "requireParamDescription": false, 134 | "requireReturnDescription": false 135 | }], 136 | 137 | // Seems like a good idea to error about this 138 | 'valid-typeof': ERROR, 139 | 140 | 141 | // -------------------------------------- 142 | // Best Practices 143 | // These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing something or help you avoid footguns. 144 | 145 | // Meh 146 | // Enforces getter/setter pairs in objects 147 | 'accessor-pairs': IGNORE, 148 | 149 | // Seems sensible 150 | // Enforces return statements in callbacks of array's methods 151 | 'array-callback-return': ERROR, 152 | 153 | // This rule seems buggy 154 | 'block-scoped-var': IGNORE, 155 | 156 | // Disable complexity checks, they are annoying and not that useful in detecting actual complexity 157 | 'complexity': IGNORE, 158 | 159 | // We use blank returns for break statements 160 | 'consistent-return': IGNORE, 161 | 162 | // Always require curly braces unless the statement is all on a single line 163 | 'curly': [ERROR, 'multi-line'], 164 | 165 | // If we don't have a default cause, it probably means we should throw an error 166 | 'default-case': ERROR, 167 | 168 | // Dots should be on the newlines 169 | // chainableThingy 170 | // .doSomething() 171 | // .doSomethingElse() 172 | 'dot-location': [ERROR, 'property'], 173 | 174 | // Use dot notation where possible 175 | 'dot-notation': ERROR, 176 | 177 | // Unless you are doing == null, then force === to avoid truthy/falsey mistakes 178 | 'eqeqeq': [ERROR, 'allow-null'], 179 | 180 | // Always use hasOwnProperty when doing for in 181 | 'guard-for-in': ERROR, 182 | 183 | // Warn about alert statements in our code 184 | // Use one of the suggested alternatives instead 185 | // Reasoning is they could be mistaken for left over debugging statements 186 | 'no-alert': WARN, 187 | 188 | // They are very slow 189 | 'no-caller': ERROR, 190 | 191 | // Wow... 192 | 'no-case-declarations': ERROR, 193 | 194 | // Seems like a good idea to error about this 195 | 'no-div-regex': ERROR, 196 | 197 | // Returns in else statements offer code clarity, so disable this rule 198 | 'no-else-return': IGNORE, 199 | 200 | // Up to developer sensibility 201 | // disallow use of empty functions 202 | 'no-empty-function': IGNORE, 203 | 204 | // Seems sensible 205 | 'no-labels': ERROR, 206 | 207 | // Seems sensible 208 | 'no-empty-pattern': ERROR, 209 | 210 | // We know that == null is a null and undefined check 211 | 'no-eq-null': IGNORE, 212 | 213 | // Eval is slow and unsafe, use vm's instead 214 | 'no-eval': ERROR, 215 | 216 | // There is never a good reason for this 217 | 'no-extend-native': ERROR, 218 | 219 | // Don't allow useless binds 220 | 'no-extra-bind': ERROR, 221 | 222 | // Seems sensible 223 | 'no-extra-label': ERROR, 224 | 225 | // Don't allow switch case statements to follow through, use continue keyword instead 226 | 'no-fallthrough': ERROR, 227 | 228 | // Use zero when doing decimals, otherwise it is confusing 229 | 'no-floating-decimal': ERROR, 230 | 231 | // Cleverness is unclear 232 | 'no-implicit-coercion': ERROR, 233 | 234 | // Seems sensible providing detection works correctly 235 | 'no-implicit-globals': ERROR, 236 | 237 | // A sneaky way to do evals 238 | 'no-implied-eval': ERROR, 239 | 240 | // This throws for a lot of senseless things, like chainy functions 241 | 'no-invalid-this': IGNORE, 242 | 243 | // Use proper iterators instead 244 | 'no-iterator': ERROR, 245 | 246 | // We never use this, it seems silly to allow this 247 | 'no-labels': ERROR, 248 | 249 | // We never use this, it seems silly to allow this 250 | 'no-lone-blocks': ERROR, 251 | 252 | // Loop functions always cause problems, as the scope isn't clear through iterations 253 | 'no-loop-func': ERROR, 254 | 255 | // Far too annoying 256 | 'no-magic-numbers': IGNORE, 257 | 258 | // We like multi spaces for clarity 259 | // E.g. We like 260 | // if ( blah ) return foo 261 | // Instead of: 262 | // if ( blah ) return foo 263 | // @TODO would be great to enforce the above 264 | 'no-multi-spaces': IGNORE, 265 | 266 | // Use ES6 template strings instead 267 | 'no-multi-str': ERROR, 268 | 269 | // Would be silly to allow this 270 | 'no-native-reassign': ERROR, 271 | 272 | // We never use this, it seems silly to allow this 273 | 'no-new-func': ERROR, 274 | 275 | // We never use this, it seems silly to allow this 276 | 'no-new-wrappers': ERROR, 277 | 278 | // We never use this, it seems silly to allow this 279 | 'no-new': ERROR, 280 | 281 | // We never use this, it seems silly to allow this 282 | 'no-octal-escape': ERROR, 283 | 284 | // We never use this, it seems silly to allow this 285 | 'no-octal': ERROR, 286 | 287 | // We got to be pretty silly if we don't realise we are doing this 288 | // As such, take any usage as intentional and aware 289 | 'no-param-reassign': IGNORE, 290 | 291 | // We use process.env wisely 292 | 'no-process-env': IGNORE, 293 | 294 | // We never use this, it seems silly to allow this 295 | 'no-proto': ERROR, 296 | 297 | // We never use this, it seems silly to allow this 298 | 'no-redeclare': ERROR, 299 | 300 | // We never use this, it seems silly to allow this 301 | 'no-return-assign': ERROR, 302 | 303 | // We never use this, it seems silly to allow this 304 | 'no-script-url': ERROR, 305 | 306 | // Seems sensible 307 | 'no-self-assign': ERROR, 308 | 309 | // We never use this, it seems silly to allow this 310 | 'no-self-compare': ERROR, 311 | 312 | // We never use this, it seems silly to allow this 313 | 'no-sequences': ERROR, 314 | 315 | // We always want proper error objects as they have stack traces and respond to instanceof Error checks 316 | 'no-throw-literal': ERROR, 317 | 318 | // Could be a getter, so warn 319 | 'no-unmodified-loop-condition': WARN, 320 | 321 | // We never use this, it seems silly to allow this 322 | 'no-unused-expressions': ERROR, 323 | 324 | // Seems sensible 325 | 'no-unused-labels': ERROR, 326 | 327 | // Seems sensible 328 | 'no-useless-call': ERROR, 329 | 330 | // Seems sensible 331 | 'no-useless-concat': ERROR, 332 | 333 | // We never use this, it seems silly to allow this 334 | 'no-void': ERROR, 335 | 336 | // Warn about todos 337 | 'no-warning-comments': [WARN, { terms: ['todo', 'fixme'], location: 'anywhere' }], 338 | 339 | // We never use this, it seems silly to allow this 340 | 'no-with': ERROR, 341 | 342 | // Always specify a radix to avoid errors 343 | 'radix': ERROR, 344 | 345 | // We appreciate the clarity late defines offer 346 | 'vars-on-top': IGNORE, 347 | 348 | // Wrap instant called functions in parenthesis for clearer intent 349 | 'wrap-iife': ERROR, 350 | 351 | // Because we force === and never allow assignments in conditions 352 | // we have no need for yoda statements, so disable them 353 | 'yoda': [ERROR, 'never'], 354 | 355 | 356 | // -------------------------------------- 357 | // Strict Mode 358 | // These rules relate to using strict mode. 359 | 360 | // Ensure that use strict is specified to prevent the runtime erorr: 361 | // SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode 362 | 'strict': [ERROR, 'global'], 363 | 364 | 365 | // -------------------------------------- 366 | // Variables 367 | // These rules have to do with variable declarations. 368 | 369 | // We don't care 370 | 'init-declaration': IGNORE, 371 | 372 | // Don't allow the catch method to shadow objects as browsers handle this differently 373 | // Update: We don't care for IE8 374 | 'no-catch-shadow': IGNORE, 375 | 376 | // Don't use delete, it disables optimisations 377 | 'no-delete-var': ERROR, 378 | 379 | // We never use this, it seems silly to allow this 380 | 'no-label-var': ERROR, 381 | 382 | // We never use this, it seems silly to allow this 383 | 'no-shadow-restricted-names': ERROR, 384 | 385 | // We use shadowing 386 | 'no-shadow': IGNORE, 387 | 388 | // Makes sense 389 | 'no-undef-init': ERROR, 390 | 391 | // Error when an undefined variable is used 392 | 'no-undef': ERROR, 393 | 394 | // typeof blah === 'undefined' should always be used 395 | 'no-undefined': ERROR, 396 | 397 | // Warn us when we don't use something 398 | 'no-unused-vars': WARN, 399 | 400 | // Error when we try and use something before it is defined 401 | 'no-use-before-define': ERROR, 402 | 403 | 404 | // -------------------------------------- 405 | // Node.js and CommonJS 406 | // These rules are specific to JavaScript running on Node.js or using CommonJS in the browser. 407 | 408 | // Seems to difficult to enforce 409 | 'callback-return': IGNORE, 410 | 411 | // We use require where it is appropriate to use it 412 | 'global-require': IGNORE, 413 | 414 | // Force handling of callback errors 415 | 'handle-callback-err': ERROR, 416 | 417 | // @TODO decide if this is good or not 418 | 'no-mixed-requires': ERROR, 419 | 420 | // Disallow error prone syntax 421 | 'no-new-require': ERROR, 422 | 423 | // Always use path.join for windows support 424 | 'no-path-concat': ERROR, 425 | 426 | // We know what we are doing 427 | 'no-process-exit': IGNORE, 428 | 429 | // No need to disallow any imports 430 | 'no-restricted-imports': IGNORE, 431 | 432 | // No need to disallow any modules 433 | 'no-restricted-modules': IGNORE, 434 | 435 | // Sometimes sync methods are useful, so warn but don't error 436 | 'no-sync': WARN, 437 | 438 | 439 | // -------------------------------------- 440 | // Stylistic 441 | // These rules are purely matters of style and are quite subjective. 442 | 443 | // We don't use spaces with brackets 444 | 'array-bracket-spacing': [ERROR, 'never'], 445 | 446 | // Disallow or enforce spaces inside of single line blocks 447 | 'block-spacing': [ERROR, 'always'], 448 | 449 | // Opening brace on same line, closing brace on its own line, except when statement is a single line 450 | 'brace-style': [ERROR, 'stroustrup', { allowSingleLine: true }], 451 | 452 | // Use camel case 453 | 'camelcase': ERROR, 454 | 455 | // Require a comma after always 456 | 'comma-spacing': [ERROR, { before: false, after: true }], 457 | 458 | // Commas go last, we have tooling to detect if we forget a comma 459 | 'comma-style': [ERROR, 'last'], 460 | 461 | // Require or disallow padding inside computed properties 462 | 'computed-property-spacing': [ERROR, 'never'], 463 | 464 | // Enabling this was incredibly annoying when doing layers of nesting 465 | 'consistent-this': IGNORE, 466 | 467 | // Enable to make UNIX people's lives easier 468 | 'eol-last': ERROR, 469 | 470 | // We like anonymous functions 471 | 'func-names': IGNORE, 472 | 473 | // Prefer to define functions via variables 474 | 'func-style': [WARN, 'declaration'], 475 | 476 | // Nothing we want to blacklist 477 | // blacklist certain identifiers to prevent them being used 478 | 'id-blacklist': IGNORE, 479 | 480 | // Sometimes short names are appropriate 481 | 'id-length': IGNORE, 482 | 483 | // Camel case handles this for us 484 | 'id-match': IGNORE, 485 | 486 | // Use tabs and indent case blocks 487 | // 'indent': [ERROR, 'tab', { SwitchCase: WARN }], 488 | // ^ broken 489 | 490 | // Prefer double qoutes for JSX properties: , 491 | 'jsx-quotes': [ERROR, 'prefer-double'], 492 | 493 | // Space after the colon 494 | 'key-spacing': [ERROR, { 495 | beforeColon: false, 496 | afterColon: true 497 | }], 498 | 499 | // Always force a space before and after a keyword 500 | 'keyword-spacing': [ERROR], 501 | 502 | // Enforce unix line breaks 503 | 'linebreak-style': [ERROR, 'unix'], 504 | 505 | // Enforce new lines before block comments 506 | 'lines-around-comment': [ERROR, { beforeBlockComment: true, allowBlockStart: true }], 507 | 508 | // Disabled to ensure consistency with complexity option 509 | 'max-depth': IGNORE, 510 | 511 | // We use soft wrap 512 | 'max-len': IGNORE, 513 | 514 | // We are smart enough to know if this is bad or not 515 | 'max-nested-callbacks': IGNORE, 516 | 517 | // Sometimes we have no control over this for compat reasons, so just warn 518 | 'max-params': [WARN, MAX_PARAMS], 519 | 520 | // We should be able to use whatever feels right 521 | 'max-statements': IGNORE, 522 | 523 | // Constructors should be CamelCase 524 | 'new-cap': ERROR, 525 | 526 | // Always use parens when instantiating a class 527 | 'new-parens': ERROR, 528 | 529 | // Too difficult to enforce correctly as too many edge-cases 530 | // require or disallow an empty newline after variable declarations 531 | 'newline-after-var': IGNORE, 532 | 533 | // Let the author decide 534 | // enforce newline after each call when chaining the calls 535 | 'newline-per-chained-call': IGNORE, 536 | 537 | // Don't use the array constructor when it is not needed 538 | 'no-array-constructor': ERROR, 539 | 540 | // We never use bitwise, they are too clever 541 | 'no-bitwise': ERROR, 542 | 543 | // We use continue 544 | 'no-continue': IGNORE, 545 | 546 | // We like inline comments 547 | 'no-inline-comments': IGNORE, 548 | 549 | // The code could be optimised if this error occurs 550 | 'no-lonely-if': ERROR, 551 | 552 | // Don't mix spaces and tabs 553 | // @TODO maybe [ERROR, 'smart-tabs'] will be better, we will see 554 | 'no-mixed-spaces-and-tabs': ERROR, 555 | 556 | // We use multiple empty lines for styling 557 | 'no-multiple-empty-lines': IGNORE, 558 | 559 | // Sometimes it is more understandable with a negated condition 560 | 'no-negated-condition': IGNORE, 561 | 562 | // Sometimes these are useful 563 | 'no-nested-ternary': IGNORE, 564 | 565 | // Use {} instead of new Object() 566 | 'no-new-object': ERROR, 567 | 568 | // We use plus plus 569 | 'no-plusplus': IGNORE, 570 | 571 | // Handled by other rules 572 | 'no-restricted-syntax': IGNORE, 573 | 574 | // We never use this, it seems silly to allow this 575 | 'no-spaced-func': ERROR, 576 | 577 | // Sometimes ternaries are useful 578 | 'no-ternary': IGNORE, 579 | 580 | // Disallow trailing spaces 581 | 'no-trailing-spaces': ERROR, 582 | 583 | // Sometimes this is useful when avoiding shadowing 584 | 'no-underscore-dangle': IGNORE, 585 | 586 | // Sensible 587 | 'no-unneeded-ternary': ERROR, 588 | 589 | // Seems sensible 590 | 'no-whitespace-before-property': ERROR, 591 | 592 | // Desirable, but too many edge cases it turns out where it is actually preferred 593 | 'object-curly-spacing': IGNORE, 594 | 595 | // We like multiple var statements 596 | 'one-var': IGNORE, 597 | 'one-var-declaration-per-line': IGNORE, 598 | 599 | // Force use of shorthands when available 600 | 'operator-assignment': [ERROR, 'always'], 601 | 602 | // Should be before, but not with =, *=, /=, += lines 603 | // @TODO figure out how to enforce 604 | 'operator-linebreak': IGNORE, 605 | 606 | // This rule doesn't appear to work correclty 607 | 'padded-blocks': IGNORE, 608 | 609 | // Seems like a good idea to error about this 610 | // 'quote-props': [ERROR, 'consistent-as-needed'], 611 | // ^ broken 612 | 613 | // Use single quotes where escaping isn't needed 614 | 'quotes': [ERROR, 'single', 'avoid-escape'], 615 | 616 | // We use YUIdoc 617 | 'require-jsdoc': IGNORE, 618 | 619 | // If semi's are used, then add spacing after 620 | 'semi-spacing': [ERROR, { before: false, after: true }], 621 | 622 | // Up to dev 623 | 'sort-imports': IGNORE, 624 | 625 | // Never use semicolons 626 | 'semi': [ERROR, 'never'], 627 | 628 | // We don't care if our vars are alphabetical 629 | 'sort-vars': IGNORE, 630 | 631 | // Always force a space before a { 632 | 'space-before-blocks': [ERROR, 'always'], 633 | 634 | // function () {, get blah () { 635 | 'space-before-function-paren': [ERROR, 'always'], 636 | 637 | // This is for spacing between [], so [ WARN, ERROR, 3 ] which we don't want 638 | 'space-in-brackets': IGNORE, 639 | 640 | // This is for spacing between (), so doSomething( WARN, ERROR, 3 ) or if ( WARN === 3 ) 641 | // which we want for ifs, but don't want for calls 642 | 'space-in-parens': IGNORE, 643 | 644 | // We use this 645 | 'space-infix-ops': ERROR, 646 | 647 | // We use this 648 | 'space-unary-ops': ERROR, 649 | 650 | // We use this 651 | // 'spaced-line-comment': ERROR, 652 | 'spaced-comment': IGNORE, 653 | 654 | // We use this 655 | // @TODO revise this 656 | 'wrap-regex': ERROR, 657 | 658 | 659 | // -------------------------------------- 660 | // ECMAScript 6 661 | 662 | // Sensible to create more informed and clear code 663 | 'arrow-body-style': [ERROR, 'as-needed'], 664 | 665 | // We do this, no reason why, just what we do 666 | 'arrow-parens': [ERROR, 'always'], 667 | 668 | // Require consistent spacing for arrow functions 669 | 'arrow-spacing': ERROR, 670 | 671 | // Makes sense as otherwise runtime error will occur 672 | 'constructor-super': ERROR, 673 | 674 | // Seems the most consistent location for it 675 | 'generator-star-spacing': [ERROR, 'before'], 676 | 677 | // Seems sensible 678 | 'no-confusing-arrow': ERROR, 679 | 680 | // Sometimes useful for debugging 681 | 'no-constant-condition': WARN, 682 | 683 | // Seems sensible 684 | 'no-class-assign': ERROR, 685 | 686 | // Our developers should know the difference 687 | // disallow arrow functions where they could be confused with comparisons 688 | 'no-confusing-arrow': IGNORE, 689 | 690 | // Makes sense as otherwise runtime error will occur 691 | 'no-const-assign': ERROR, 692 | 693 | // Makes sense as otherwise runtime error will occur 694 | 'no-dupe-class-members': ERROR, 695 | 696 | // Seems sensible 697 | 'no-new-symbol': ERROR, 698 | 699 | // Makes sense as otherwise runtime error will occur 700 | 'no-this-before-super': ERROR, 701 | 702 | // Seems sensible 703 | 'no-useless-constructor': ERROR, 704 | 705 | // @TODO This probably should be an error 706 | // however it is useful for: for ( var key in obj ) { 707 | // which hopefully is more performant than let (@TODO check if it actually is more performant) 708 | 'no-var': IGNORE, 709 | 710 | // Enforce ES6 object shorthand 711 | 'object-shorthand': IGNORE, 712 | 713 | // Better performance when running native 714 | // but horrible performance if not running native as could fallback to bind 715 | // https://travis-ci.org/bevry/es6-benchmarks 716 | 'prefer-arrow-callback': IGNORE, 717 | 718 | // Sure, why not 719 | 'prefer-const': IGNORE, 720 | 721 | // Controversial change, but makes sense to move towards to reduce the risk of bad people overwriting apply and call 722 | // https://github.com/eslint/eslint/issues/ERROR939 723 | // Ignoring because node does not yet support it, so we don't want to get the performance hit of using the compiled ES5 version 724 | 'prefer-reflect': IGNORE, 725 | 726 | // Makes sense to enforce, exceptions should be opted out of on case by case 727 | 'prefer-rest-params': ERROR, 728 | 729 | // Sure, why not 730 | 'prefer-spread': ERROR, 731 | 732 | // Too annoying to enforce 733 | 'prefer-template': IGNORE, 734 | 735 | // Makes sense 736 | 'require-yield': ERROR, 737 | 738 | // Makes sense 739 | 'template-curly-spacing': [ERROR, 'never'], 740 | 741 | // Our preference 742 | 'yield-star-spacing': [ERROR, 'both'], 743 | 744 | 745 | // -------------------------------------- 746 | // Plugins 747 | 748 | // Not sure why, but okay 749 | 'babel/no-await-in-loop': WARN, 750 | 'flow-vars/define-flow-type': WARN, 751 | 'flow-vars/use-flow-type': WARN 752 | } 753 | } 754 | 755 | // ------------------------------------ 756 | // Enhancements 757 | 758 | // Load package.json file if it exists 759 | var rules = Object.keys(config.rules) 760 | var package = {}, devDeps = [] 761 | try { 762 | package = require('./package.json') || {} 763 | devDeps = Object.keys(package.devDependencies || {}) 764 | } 765 | catch ( err ) {} 766 | 767 | // Add babel parsing if installed 768 | if ( devDeps.indexOf('babel-eslint') !== -1 ) { 769 | config.parser = 'babel-eslint' 770 | } 771 | 772 | // Add react linting if installed 773 | if ( devDeps.indexOf('eslint-plugin-react') !== -1 ) { 774 | config.extends.push('plugin:react/recommended') 775 | config.plugins.push('react') 776 | } 777 | 778 | if ( devDeps.indexOf('eslint-plugin-babel') !== -1 ) { 779 | // Remove rules that babel rules replace 780 | config.plugins.push('babel') 781 | var replacements = [ 782 | 'array-bracket-spacing', 783 | 'new-cap', 784 | 'object-curly-spacing', 785 | 'arrow-parens', 786 | 'generator-star-spacing', 787 | 'object-shorthand' 788 | ] 789 | replacements.forEach(function (key) { 790 | if ( rules.indexOf(key) !== -1 ) { 791 | config.rules['babel/' + key] = config.rules[key] 792 | config.rules[key] = IGNORE 793 | } 794 | }) 795 | } 796 | else { 797 | // Remove babel rules if not using babel 798 | rules.forEach(function (key) { 799 | if ( key.indexOf('babel/') === 0 ) { 800 | delete config.rules[key] 801 | } 802 | }) 803 | } 804 | 805 | if ( devDeps.indexOf('eslint-plugin-flow-vars') !== -1 ) { 806 | // Add flow plugin if installed 807 | config.plugins.push('flow-vars') 808 | } 809 | else { 810 | // Remove flow rules if plugin not installed 811 | rules.forEach(function (key) { 812 | if ( key.indexOf('flow-vars/') === 0 ) { 813 | delete config.rules[key] 814 | } 815 | }) 816 | } 817 | 818 | 819 | // ------------------------------------ 820 | // Export 821 | 822 | module.exports = config 823 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2016 March 21 2 | # https://github.com/bevry/base 3 | 4 | # Temp Files 5 | **/.docpad.db 6 | **/out.* 7 | **/*.log 8 | **/*.cpuprofile 9 | **/*.heapsnapshot 10 | 11 | # Build Files 12 | build/ 13 | components/ 14 | bower_components/ 15 | node_modules/ 16 | out/ 17 | *output/ 18 | coffeejs/ 19 | coffee/ 20 | es5/ 21 | es2015/ 22 | esnext/ 23 | 24 | # Editor Caches 25 | .c9/ 26 | 27 | # Private Files 28 | .env 29 | .idea 30 | .cake_task_cache 31 | 32 | 33 | # ===================================== 34 | # CUSTOM 35 | 36 | # None 37 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # 2016 June 6 2 | # https://github.com/bevry/base 3 | 4 | # Temp Files 5 | **/.docpad.db 6 | **/out.* 7 | **/*.log 8 | **/*.cpuprofile 9 | **/*.heapsnapshot 10 | 11 | # Build Files 12 | build/ 13 | components/ 14 | bower_components/ 15 | node_modules/ 16 | 17 | # Private Files 18 | .env 19 | 20 | # Documentation Files 21 | docs/ 22 | guides/ 23 | BACKERS.md 24 | CONTRIBUTING.md 25 | HISTORY.md 26 | 27 | # Development Files 28 | web/ 29 | **/example* 30 | **/test* 31 | .editorconfig 32 | .eslintrc* 33 | .jshintrc 34 | .jscrc 35 | coffeelint* 36 | .travis* 37 | nakefile* 38 | Cakefile 39 | Makefile 40 | 41 | # Other Package Definitions 42 | template.js 43 | component.json 44 | bower.json 45 | 46 | # ===================================== 47 | # CUSTOM MODIFICATIONS 48 | 49 | # None 50 | -------------------------------------------------------------------------------- /CHECKLIST.md: -------------------------------------------------------------------------------- 1 | # Benjamin Lupton's Project Checklist 2 | 3 | v0.1.2, 2016 October 8 4 | 5 | All Projects: 6 | 7 | - Have you run all the unit tests for the project? 8 | - Have you remembered to remake the project? `npm run prepare` 9 | - Have you tested in all major browsers? 10 | - Have you ensured all documentation dates are correct? 11 | - Have you ensured all documentation project links are current? 12 | - Have you ensured version changelog entries have been added to appropriate file? 13 | - If yes; then you are good to release, see `CONTRIBUTING.md` for details 14 | 15 | Project Specific: 16 | 17 | - Have you remembered to set it back to the minified version in the demo? 18 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Before You Post! 7 | 8 | ## Support 9 | 10 | We offer support through our [Official Support Channels](https://bevry.me/support). Do not use GitHub Issues for support, your issue will be closed. 11 | 12 | 13 | ## Contribute 14 | 15 | Our [Contributing Guide](https://learn.bevry.me/community/contribute) contains useful tips and suggestions for how to contribute to this project, it's worth the read. 16 | 17 | 18 | ## Development 19 | 20 | ### Setup 21 | 22 | 1. Install [Node.js](https://learn.bevry.me/node/install) 23 | 24 | 1. Fork the project and clone your fork - [guide](https://help.github.com/articles/fork-a-repo/) 25 | 26 | 1. Install local dependencies 27 | 28 | ``` bash 29 | npm install 30 | ``` 31 | 32 | 1. Perform any other setup operations 33 | 34 | ``` bash 35 | npm run-script setup 36 | ``` 37 | 38 | 39 | ### Developing 40 | 41 | 1. Compile changes 42 | 43 | ``` bash 44 | npm run-script compile 45 | ``` 46 | 47 | 1. Run tests 48 | 49 | ``` bash 50 | npm test 51 | ``` 52 | 53 | 54 | ### Publishing 55 | 56 | Follow these steps in order to implement your changes/improvements into your desired project: 57 | 58 | 59 | #### Preparation 60 | 61 | 1. Make sure your changes are on their own branch that is branched off from master. 62 | 1. You can do this by: `git checkout master; git checkout -b your-new-branch` 63 | 1. And push the changes up by: `git push origin your-new-branch` 64 | 65 | 1. Ensure all tests pass: 66 | 67 | ``` bash 68 | npm test 69 | ``` 70 | 71 | > If possible, add tests for your change, if you don't know how, mention this in your pull request 72 | 73 | 1. Ensure the project is ready for publishing: 74 | 75 | ``` 76 | git status 77 | git diff 78 | npm run-script prepare 79 | ``` 80 | 81 | 82 | #### Pull Request 83 | 84 | To send your changes for the project owner to merge in: 85 | 86 | 1. Submit your pull request 87 | 1. When submitting, if the original project has a `dev` or `integrate` branch, use that as the target branch for your pull request instead of the default `master` 88 | 1. By submitting a pull request you agree for your changes to have the same license as the original plugin 89 | 90 | 91 | #### Publish 92 | 93 | To publish your changes as the project owner: 94 | 95 | 1. Switch to the master branch: 96 | 97 | ``` bash 98 | git checkout master 99 | ``` 100 | 101 | 1. Merge in the changes of the feature branch (if applicable) 102 | 103 | 1. Increment the version number in the `package.json` file according to the [semantic versioning](http://semver.org) standard, that is: 104 | 1. `x.0.0` MAJOR version when you make incompatible API changes (note: DocPad plugins must use v2 as the major version, as v2 corresponds to the current DocPad v6.x releases) 105 | 1. `x.y.0` MINOR version when you add functionality in a backwards-compatible manner 106 | 1. `x.y.z` PATCH version when you make backwards-compatible bug fixes 107 | 108 | 1. Add an entry to the changelog following the format of the previous entries, an example of this is: 109 | 110 | ``` markdown 111 | ## v6.29.0 2013 April 1 112 | - Progress on [issue #474](https://github.com/bevry/docpad/issues/474) 113 | - DocPad will now set permissions based on the process's ability 114 | - Thanks to [Avi Deitcher](https://github.com/deitch), [Stephan Lough](https://github.com/stephanlough) for [issue #165](https://github.com/bevry/docpad/issues/165) 115 | - Updated dependencies 116 | ``` 117 | 118 | 119 | 1. Commit the changes with the commit title set to something like `v6.29.0. Bugfix. Improvement.` and commit description set to the changelog entry 120 | 121 | 122 | 1. Ensure the project is ready for publishing: 123 | 124 | ``` 125 | git status 126 | git diff 127 | npm run-script prepare 128 | ``` 129 | 130 | 1. Prepare the release and publish it to npm and git: 131 | 132 | ``` bash 133 | npm run-script release 134 | ``` 135 | 136 | > A prompt will occur asking you for a git tag annotation, enter the changelog entry that we created earlier, save and exit the prompt. 137 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | # History 2 | 3 | ## v1.4.6 2016 October 8 4 | - Added `jquery-plugin` keyword 5 | 6 | ## v1.4.5 2016 October 8 7 | - Fixed an issue where if the container's scrollable height is equal to the container width, no vertical scrolling occurs 8 | - Thanks to [Andy](https://github.com/Inumedia) for [pull request #32](https://github.com/balupton/jquery-scrollto/pull/32) 9 | - Updated internal conventions 10 | 11 | ## v1.4.4 2013 May 29 12 | - Removed incorrect requirement of backbone peer dependency 13 | 14 | ## v1.4.3 2013 May 10 15 | - Internet Explorer support 16 | - Fix wobble on iOS 17 | 18 | ## v1.4.2 2013 May 10 19 | - Fixed a bug in the jQuery animation code that prevented scrolling from working smoothly on iOS devices 20 | 21 | ## v1.4.1 2013 May 10 22 | - Better cross-browser support 23 | - Fix iOS support 24 | 25 | ## v1.4.0 2013 May 10 26 | - Better cross-browser support 27 | - Removed need for `$.browser` and thus removed need for the jQuery Migrate plugin 28 | 29 | ## v1.3.0 2013 May 9 30 | - Restructured for latest practices 31 | 32 | ## v1.2.1 2012 October 21 33 | - Workaround for Safari 6 34 | - Closes [#8](https://github.com/balupton/jquery-scrollto/issues/8) thanks to [Cameron Spear](https://github.com/CWSpear), [Dhruv Bhatia](https://github.com/dhruv-bhatia), [Fabricio Quagliariello](https://github.com/fmquaglia) for their help 35 | 36 | ## v1.2.0 2012 July 2 37 | - Added `onlyIfOutside` option 38 | 39 | ## v1.1.0 2012 July 2 40 | - Added `offsetTop` and `offsetLeft` options 41 | - Fixed firefox body scroll issue 42 | - Added horizontal scrolling 43 | - Closes 2, 3, 5, 6, 7 44 | 45 | ## v1.0.2 2012 July 2 46 | - Coding standards update 47 | - Fixed global leak 48 | 49 | ## v1.0.1-beta 2010 August 31 50 | - Fixed body scrolling in IE 51 | 52 | ## v1.0.0-beta 2010 August 28 53 | - Initial Released Version 54 | 55 | ## v0.1.0-dev 2010 August 27 56 | - Initial Development Version 57 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

License

4 | 5 | Unless stated otherwise all works are: 6 | 7 |
8 | 9 | and licensed under: 10 | 11 | 12 | 13 |

MIT License

14 | 15 |
16 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
17 | 
18 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
19 | 
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | 
22 | 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

jQuery ScrollTo

4 | 5 | 6 | 7 | 8 | 9 | 10 | NPM version 11 | NPM downloads 12 | Dependency Status 13 | Dev Dependency Status 14 |
15 | Slack community badge 16 | Patreon donate button 17 | Gratipay donate button 18 | Flattr donate button 19 | PayPal donate button 20 | Bitcoin donate button 21 | Wishlist browse button 22 | 23 | 24 | 25 | 26 | 27 | 28 | Smooth scroll to any jQuery/DOM element 29 | 30 | 31 | 32 | 33 | 34 | 35 |

Install

36 | 37 |

NPM

40 | 41 |

Browserify

45 | 46 |

Ender

49 | 50 | 51 | 52 | 53 | ### Direct 54 | - CDN URL: `//rawgit.com/balupton/jquery-scrollto/gh-pages/lib/jquery-scrollto.js` 55 | - ZIP: https://github.com/balupton/jquery-scrollto/zipball/gh-pages 56 | 57 | 58 | ## Usage & Demo 59 | [Refer to the demo for usage and demo](http://balupton.github.io/jquery-scrollto/) 60 | 61 | 62 | 63 | 64 |

History

65 | 66 | Discover the release history by heading on over to the HISTORY.md file. 67 | 68 | 69 | 70 | 71 | 72 | 73 |

Contribute

74 | 75 | Discover how you can contribute by heading on over to the CONTRIBUTING.md file. 76 | 77 | 78 | 79 | 80 | 81 | 82 |

Backers

83 | 84 |

Maintainers

85 | 86 | These amazing people are maintaining this project: 87 | 88 | 90 | 91 |

Sponsors

92 | 93 | No sponsors yet! Will you be the first? 94 | 95 | Patreon donate button 96 | Gratipay donate button 97 | Flattr donate button 98 | PayPal donate button 99 | Bitcoin donate button 100 | Wishlist browse button 101 | 102 |

Contributors

103 | 104 | These amazing people have contributed code to this project: 105 | 106 | 109 | 110 | Discover how you can contribute by heading on over to the CONTRIBUTING.md file. 111 | 112 | 113 | 114 | 115 | 116 | 117 |

License

118 | 119 | Unless stated otherwise all works are: 120 | 121 | 122 | 123 | and licensed under: 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /docpad.js: -------------------------------------------------------------------------------- 1 | const packageData = require('./package.json') 2 | module.exports = { 3 | templateData: { 4 | package: packageData, 5 | site: { 6 | url: packageData.homepage, 7 | services: { 8 | twitterTweetButton: 'balupton', 9 | twitterFollowButton: 'balupton', 10 | githubFollowButton: 'balupton' 11 | } 12 | } 13 | }, 14 | 15 | plugins: { 16 | highlightjs: { 17 | removeIndentation: true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "jQuery ScrollTo", 3 | "name": "jquery-scrollto", 4 | "version": "1.4.6", 5 | "description": "Smooth scroll to any jQuery/DOM element", 6 | "homepage": "https://balupton.github.io/jquery-scrollto/", 7 | "project": "https://github.com/balupton/jquery-scrollto", 8 | "download": "https://github.com/balupton/jquery-scrollto/zipball/gh-pages", 9 | "license": "MIT", 10 | "badges": { 11 | "list": [ 12 | "npmversion", 13 | "npmdownloads", 14 | "daviddm", 15 | "daviddmdev", 16 | "---", 17 | "slackin", 18 | "patreon", 19 | "gratipay", 20 | "flattr", 21 | "paypal", 22 | "bitcoin", 23 | "wishlist" 24 | ], 25 | "config": { 26 | "patreonUsername": "bevry", 27 | "gratipayUsername": "bevry", 28 | "flattrUsername": "balupton", 29 | "paypalURL": "https://bevry.me/paypal", 30 | "bitcoinURL": "https://bevry.me/bitcoin", 31 | "wishlistURL": "https://bevry.me/wishlist", 32 | "slackinURL": "https://slack.bevry.me" 33 | } 34 | }, 35 | "keywords": [ 36 | "jquery", 37 | "scroll", 38 | "scrolling", 39 | "scrollto", 40 | "smooth", 41 | "dom", 42 | "jquery-plugin" 43 | ], 44 | "author": "2010+ Benjamin Lupton (http://balupton.com)", 45 | "maintainers": [ 46 | "Benjamin Lupton (http://balupton.com)", 47 | "Andy (http://inumedia.net)" 48 | ], 49 | "contributors": [ 50 | "Benjamin Lupton (http://balupton.com)", 51 | "Andy (http://inumedia.net)", 52 | "Peter Dave Hello (http://www.peterdavehello.org/)" 53 | ], 54 | "bugs": { 55 | "url": "https://github.com/balupton/jquery-scrollto/issues" 56 | }, 57 | "repository": { 58 | "type": "git", 59 | "url": "https://github.com/balupton/jquery-scrollto.git" 60 | }, 61 | "main": "out/lib/jquery-scrollto.js", 62 | "browser": { 63 | "jquery": false 64 | }, 65 | "scripts": { 66 | "clean": "rm -Rf ./out", 67 | "compile": "npm run compile:docpad", 68 | "compile:docpad": "docpad generate --env static", 69 | "meta": "npm run meta:projectz", 70 | "meta:projectz": "projectz compile", 71 | "prepare": "npm run compile && npm run test && npm run meta", 72 | "release": "npm run prepare && npm run release:publish && npm run release:tag && npm run release:push && npm run release:deploy", 73 | "release:publish": "npm publish", 74 | "release:tag": "git tag v$npm_package_version -a", 75 | "release:push": "git push origin master && git push origin --tags", 76 | "release:deploy": "docpad deploy-ghpages --env static", 77 | "pretest": "npm run test:eslint", 78 | "test:eslint": "eslint ./source", 79 | "test": "echo 'no tests'" 80 | }, 81 | "dependencies": {}, 82 | "devDependencies": { 83 | "docpad": "6.x", 84 | "docpad-plugin-cleanurls": "2.x", 85 | "docpad-plugin-eco": "2.x", 86 | "docpad-plugin-ghpages": "2.x", 87 | "docpad-plugin-highlightjs": "2.x", 88 | "docpad-plugin-livereload": "2.x", 89 | "docpad-plugin-services": "2.x", 90 | "docpad-plugin-umd": "2.x", 91 | "eslint": "^2.13.1", 92 | "projectz": "^1.2.0" 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/layouts/default.html.eco: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | <%- @getBlock('meta').toHTML() %> 12 | 13 | 14 | <%= @package.title %> - <%= @package.tagline or @package.description %> 15 | 16 | 17 | <%- @getBlock('styles').add(@site.styles or []).add(@document.styles or []).toHTML() %> 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 50 | 51 |
52 |

About

53 | 54 |

55 | <%= @package.title %> is a great way to <%= @package.description.substring(0,1).toLowerCase()+@package.description.substring(1) %> 56 |

57 | 58 |
    59 |
  • Extremely simple to use: just call $('#element).ScrollTo() and your user will be smoothly scrolled to that element!
  • 60 |
  • Only 1KB in size! Making it the smallest ScrollTo plugin and won't slow you down.
  • 61 |
  • Supports all the elements you can throw at it! Even those ones in modals and scrollable areas! So you can now feel at ease knowing your user will always be scrolled to that correct place which you intended.
  • 62 |
  • It's even easy customise and work with! You can specify such options as duration, easing, and callback on your ScrollTo call.
  • 63 |
64 | 65 |

Enough talk, let's see it in action!

66 |
67 | 68 | <%- @content %> 69 | 70 |
71 |

Installation

72 | 73 |

Step 1. Download <%= @package.title %>, and extract it to your hard drive

74 |
75 | As everyones extraction process is a little bit different be sure of the following: 76 |
    77 |
  • If the archive was extracted and you have a whole bunch of files and directories (folders), then you must create a new directory called <%= @package.name %> and move all the files and directories into that to continue.
  • 78 |
  • If the archive was extracted and you have only one directory called <%= @package.name %> which has a whole bunch of stuff in it, then that is fine and you can continue onto the next step.
  • 79 |
  • If the archive was extracted and you have only one directory and it is not called <%= @package.name %> then you must rename it to <%= @package.name %> to continue.
  • 80 |
81 |
82 | 83 |

Step 2. Move the <%= @package.name %> directory to somewhere on your webserver

84 |

Be sure to always keep the entire <%= @package.name %> directory intact; this means if you were to only move some of the files instead of moving the entire directory, then you would run into problems due to the cross directory references would no longer be working.

85 | 86 |

Step 3. Include jQuery (insert into your page's head tag)

87 |

If your page already has jQuery included then you can skip this step.

88 |

 89 | 			<!-- Include jQuery (Dependency of <%= @package.title %>) -->
 90 | 			<script src="http://www.yoursite.com/somewhere/on/your/webserver/<%= @package.name %>/vendor/jquery.js"></script>
 91 | 		
92 | 93 |

Step 4. Include <%= @package.title %> (insert into your page's head tag)

94 |

 95 | 			<!-- Include <%= @package.title %> -->
 96 | 			<script src="http://www.yoursite.com/somewhere/on/your/webserver/<%= @package.name %>/lib/<%= @package.name %>.js"></script>
 97 | 		
98 |
99 | 100 |
101 |

Enjoy!!!

102 |

103 | If anything isn't working the way you want it to, or if you would like to request a feature or provide praise or general feedback then be sure to click the feedback button to the right, or the "Get Support" link up the top of this page. 104 |

105 |

106 | This work is powered by coffee and distributed for free. Donations are how we afford our coffee. Coffee is how we stay awake after our day job hours to work on things like this free open-source project which you're looking at. So go ahead, and get that warm fuzzy feeling knowing you just helped some poor fellow working after hours for free to buy his coffee. You only need to spare a few dollars, or as much as you feel this piece of work is worth. Thanks so much. Alternatively; if you are not in a donating mood, then spreading the word about this project on twitter, your blog, or whatever is just as good. You can also give praise by clicking the feedback button or visiting our "Get Support" link. Thanks a bunch, we appreciate the help deeply. 107 |

108 | 109 | Paypal donation button 110 | 111 |

112 | Licensed under the <%= @package.license.title or @package.license.name %> License. 113 |

114 |
115 |
116 | 117 | 118 | 119 | 120 | 121 | 122 | <%- @getBlock('scripts').add(@site.scripts or []).add(@document.scripts or []).toHTML() %> 123 | 124 | 125 | -------------------------------------------------------------------------------- /src/render/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | urls: ['/demo/'] 4 | --- 5 | 6 |
7 |

Using

8 | 9 |
10 | 11 |
12 |
13 | #scrollto1: 14 |

15 | 					$('#scrollto1').ScrollTo();
16 | 				
17 |
18 |
19 | #scrollto2 20 |

21 | 					$('#scrollto2').ScrollTo({
22 | 						duration: 2000,
23 | 						easing: 'linear'
24 | 					});
25 | 				
26 |
27 |
28 | #scrollto3 29 |

30 | 					$('#scrollto3').ScrollTo({
31 | 						duration: 2000,
32 | 						durationMode: 'all'
33 | 					});
34 | 				
35 |
36 |
37 | #scrollto4 38 |

39 | 					$('#scrollto4').ScrollTo({
40 | 						duration: 2000,
41 | 						callback: function(){
42 | 							alert('Scrolling has now completed.');
43 | 						}
44 | 					});
45 | 				
46 |
47 |
48 | #scrollto5 49 |

50 | 					$('#scrollto5').ScrollTo();
51 | 				
52 |
53 |
54 | #scrollto6 55 |

56 | 					$('#scrollto6').ScrollTo({
57 | 						onlyIfOutside: true
58 | 					});
59 | 				
60 |
61 |
62 | 77 |
78 |
79 | -------------------------------------------------------------------------------- /src/static/lib/jquery-scrollto.js: -------------------------------------------------------------------------------- 1 | /*** 2 | umd: true 3 | ***/ 4 | 5 | (function () { 6 | // Prepare 7 | var $, ScrollTo 8 | $ = window.jQuery || require('jquery') 9 | 10 | // Fix scrolling animations on html/body on safari 11 | $.propHooks.scrollTop = $.propHooks.scrollLeft = { 12 | get: function (elem, prop) { 13 | var result = null 14 | if ( elem.tagName === 'HTML' || elem.tagName === 'BODY' ) { 15 | if ( prop === 'scrollLeft' ) { 16 | result = window.scrollX 17 | } 18 | else if ( prop === 'scrollTop' ) { 19 | result = window.scrollY 20 | } 21 | } 22 | if ( result == null ) { 23 | result = elem[prop] 24 | } 25 | return result 26 | } 27 | } 28 | $.Tween.propHooks.scrollTop = $.Tween.propHooks.scrollLeft = { 29 | get: function (tween) { 30 | return $.propHooks.scrollTop.get(tween.elem, tween.prop) 31 | }, 32 | set: function (tween) { 33 | // Our safari fix 34 | if ( tween.elem.tagName === 'HTML' || tween.elem.tagName === 'BODY' ) { 35 | // Defaults 36 | tween.options.bodyScrollLeft = (tween.options.bodyScrollLeft || window.scrollX) 37 | tween.options.bodyScrollTop = (tween.options.bodyScrollTop || window.scrollY) 38 | 39 | // Apply 40 | if ( tween.prop === 'scrollLeft' ) { 41 | tween.options.bodyScrollLeft = Math.round(tween.now) 42 | } 43 | else if ( tween.prop === 'scrollTop' ) { 44 | tween.options.bodyScrollTop = Math.round(tween.now) 45 | } 46 | 47 | // Apply 48 | window.scrollTo(tween.options.bodyScrollLeft, tween.options.bodyScrollTop) 49 | } 50 | // jQuery's IE8 Fix 51 | else if ( tween.elem.nodeType && tween.elem.parentNode ) { 52 | tween.elem[tween.prop] = tween.now 53 | } 54 | } 55 | } 56 | 57 | // jQuery ScrollTo 58 | ScrollTo = { 59 | // Configuration 60 | config: { 61 | duration: 400, 62 | easing: 'swing', 63 | callback: null, 64 | durationMode: 'each', 65 | offsetTop: 0, 66 | offsetLeft: 0 67 | }, 68 | 69 | // Set Configuration 70 | configure: function (options) { 71 | // Apply Options to Config 72 | $.extend(ScrollTo.config, options || {}) 73 | 74 | // Chain 75 | return this 76 | }, 77 | 78 | // Perform the Scroll Animation for the Collections 79 | // We use $inline here, so we can determine the actual offset start for each overflow:scroll item 80 | // Each collection is for each overflow:scroll item 81 | scroll: function (collections, config) { 82 | // Prepare 83 | var collection, $container, $target, $inline, position, 84 | containerScrollTop, containerScrollLeft, 85 | containerScrollTopEnd, containerScrollLeftEnd, 86 | startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted, 87 | startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted, 88 | scrollOptions, 89 | callback 90 | 91 | // Determine the Scroll 92 | collection = collections.pop() 93 | $container = collection.$container 94 | $target = collection.$target 95 | 96 | // Prepare the Inline Element of the Container 97 | $inline = $('').css({ 98 | 'position': 'absolute', 99 | 'top': '0px', 100 | 'left': '0px' 101 | }) 102 | position = $container.css('position') 103 | 104 | // Insert the Inline Element of the Container 105 | $container.css({position: 'relative'}) 106 | $inline.appendTo($container) 107 | 108 | // Determine the top offset 109 | startOffsetTop = $inline.offset().top 110 | targetOffsetTop = $target.offset().top 111 | targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop, 10) 112 | 113 | // Determine the left offset 114 | startOffsetLeft = $inline.offset().left 115 | targetOffsetLeft = $target.offset().left 116 | targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft, 10) 117 | 118 | // Determine current scroll positions 119 | containerScrollTop = $container.prop('scrollTop') 120 | containerScrollLeft = $container.prop('scrollLeft') 121 | 122 | // Reset the Inline Element of the Container 123 | $inline.remove() 124 | $container.css({position: position}) 125 | 126 | // Prepare the scroll options 127 | scrollOptions = {} 128 | 129 | // Prepare the callback 130 | callback = function () { 131 | // Check 132 | if ( collections.length === 0 ) { 133 | // Callback 134 | if ( typeof config.callback === 'function' ) { 135 | config.callback() 136 | } 137 | } 138 | else { 139 | // Recurse 140 | ScrollTo.scroll(collections, config) 141 | } 142 | // Return true 143 | return true 144 | } 145 | 146 | // Handle if we only want to scroll if we are outside the viewport 147 | if ( config.onlyIfOutside ) { 148 | // Determine current scroll positions 149 | containerScrollTopEnd = containerScrollTop + $container.height() 150 | containerScrollLeftEnd = containerScrollLeft + $container.width() 151 | 152 | // Check if we are in the range of the visible area of the container 153 | if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) { 154 | targetOffsetTopAdjusted = containerScrollTop 155 | } 156 | if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) { 157 | targetOffsetLeftAdjusted = containerScrollLeft 158 | } 159 | } 160 | 161 | // Determine the scroll options 162 | if ( targetOffsetTopAdjusted !== containerScrollTop ) { 163 | scrollOptions.scrollTop = targetOffsetTopAdjusted 164 | } 165 | if ( targetOffsetLeftAdjusted !== containerScrollLeft ) { 166 | scrollOptions.scrollLeft = targetOffsetLeftAdjusted 167 | } 168 | 169 | // Check to see if the scroll is necessary 170 | if ( $container.prop('scrollHeight') === $container.height() ) { 171 | delete scrollOptions.scrollTop 172 | } 173 | if ( $container.prop('scrollWidth') === $container.width() ) { 174 | delete scrollOptions.scrollLeft 175 | } 176 | 177 | // Perform the scroll 178 | if ( scrollOptions.scrollTop != null || scrollOptions.scrollLeft != null ) { 179 | $container.animate(scrollOptions, { 180 | duration: config.duration, 181 | easing: config.easing, 182 | complete: callback 183 | }) 184 | } 185 | else { 186 | callback() 187 | } 188 | 189 | // Return true 190 | return true 191 | }, 192 | 193 | // ScrollTo the Element using the Options 194 | fn: function (options) { 195 | // Prepare 196 | var collections, config, $container, container 197 | collections = [] 198 | 199 | // Prepare 200 | var $target = $(this) 201 | if ( $target.length === 0 ) { 202 | // Chain 203 | return this 204 | } 205 | 206 | // Handle Options 207 | config = $.extend({}, ScrollTo.config, options) 208 | 209 | // Fetch 210 | $container = $target.parent() 211 | container = $container.get(0) 212 | 213 | // Cycle through the containers 214 | while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) { 215 | // Check Container for scroll differences 216 | var containerScrollTop, containerScrollLeft 217 | containerScrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight 218 | containerScrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth 219 | if ( containerScrollTop || containerScrollLeft ) { 220 | // Push the Collection 221 | collections.push({ 222 | '$container': $container, 223 | '$target': $target 224 | }) 225 | // Update the Target 226 | $target = $container 227 | } 228 | // Update the Container 229 | $container = $container.parent() 230 | container = $container.get(0) 231 | } 232 | 233 | // Add the final collection 234 | collections.push({ 235 | '$container': $('html'), 236 | // document.body doesn't work in firefox, html works for all 237 | // internet explorer starts at the beggining 238 | '$target': $target 239 | }) 240 | 241 | // Adjust the Config 242 | if ( config.durationMode === 'all' ) { 243 | config.duration /= collections.length 244 | } 245 | 246 | // Handle 247 | ScrollTo.scroll(collections, config) 248 | 249 | // Chain 250 | return this 251 | } 252 | } 253 | 254 | // Apply our extensions to jQuery 255 | $.ScrollTo = $.ScrollTo || ScrollTo 256 | $.fn.ScrollTo = $.fn.ScrollTo || ScrollTo.fn 257 | 258 | // Export 259 | return ScrollTo 260 | }).call(this) 261 | -------------------------------------------------------------------------------- /src/static/styles/generic.css: -------------------------------------------------------------------------------- 1 | /* -- Body ---------------------------------- */ 2 | 3 | body { 4 | padding-left: 0; 5 | padding-right: 0; 6 | font-family: Arial, Helvetica, sans-serif; 7 | color: #000000; 8 | } 9 | body.loading { 10 | cursor: wait; 11 | } 12 | 13 | .clear { 14 | clear: left; 15 | } 16 | 17 | 18 | /* -- Headings ---------------------------------- */ 19 | 20 | h1 { 21 | font-size: 2.5em; 22 | font-weight: bold; 23 | margin: 0.67em 0 0.5em; 24 | } 25 | 26 | h2 { 27 | font-size: 2em; 28 | font-weight: bold; 29 | margin: 0.83em 0 0.4em; 30 | } 31 | 32 | h3 { 33 | font-size: 1.5em; 34 | font-weight: bold; 35 | margin: 0.83em 0 0.3em; 36 | } 37 | 38 | 39 | /* -- Code ---------------------------------- */ 40 | 41 | pre > code { 42 | border: 5px solid #DDD; 43 | padding: 7px; 44 | font-size: 14px; 45 | overflow: auto; 46 | max-height: 500px; 47 | width: 100%; 48 | white-space: pre; 49 | display: block; 50 | } 51 | 52 | span.code { 53 | font-family: "Courier New", Courier, monospace; 54 | margin-left: 10px; 55 | padding-left: 10px; 56 | font-size: 11px; 57 | border-left: 1px solid #000; 58 | } 59 | 60 | /* -- Emphasis ---------------------------------- */ 61 | 62 | strong { 63 | font-weight: bold; 64 | } 65 | 66 | em { 67 | font-style: italic; 68 | } 69 | 70 | 71 | /* -- Paragraphs ---------------------------------- */ 72 | 73 | p .section div { 74 | padding: 0; 75 | margin: 1em 0; 76 | } 77 | 78 | .section.install p, 79 | .section.install div { 80 | margin: 0.2em 0 1em; 81 | } 82 | 83 | 84 | /* -- Inputs ---------------------------------- */ 85 | 86 | textarea { 87 | width: 100%; 88 | } 89 | 90 | label { 91 | font-weight: bold; 92 | } 93 | 94 | /* -- Columns ---------------------------------- */ 95 | 96 | .cols.two { /* is this a bug, is it meant to be .cols .two ? */ 97 | position: relative; 98 | overflow: auto; 99 | } 100 | 101 | .cols .one { 102 | width: 49%; 103 | float: left; 104 | } 105 | 106 | .cols .two { 107 | width: 49%; 108 | float: right; 109 | } 110 | 111 | 112 | /* -- Links ---------------------------------- */ 113 | 114 | a.help { 115 | text-decoration: none; 116 | border-bottom:1px dotted #00E 117 | } 118 | 119 | a:visited { 120 | border-bottom:1px dotted #551A8B 121 | } 122 | 123 | /* -- Sections ---------------------------------- */ 124 | 125 | .section { 126 | border-top: 1px solid #BBB; 127 | margin-top: 15px; 128 | margin-left: 5%; 129 | margin-right: 5%; 130 | padding: 5px; 131 | padding-bottom: 0; 132 | background-color: white; 133 | } 134 | 135 | .section ul { 136 | list-style: none; 137 | margin-top: 5px; 138 | } 139 | .section ul li { 140 | display: inline; 141 | } 142 | 143 | .section ul.features { 144 | display: block; 145 | list-style: disc; 146 | margin-left: 2em; 147 | } 148 | .section ul.features li { 149 | list-style: disc; 150 | display: list-item; 151 | } 152 | 153 | .section ul.install, 154 | .section ul.install li { 155 | list-style: disc outside none; 156 | } 157 | .section ul.install { 158 | margin-left: 2em; 159 | } 160 | .section ul.install li { 161 | display: list-item; 162 | } 163 | 164 | .section .link { 165 | font-size: 12px; 166 | font-style: italic; 167 | padding-left: 10px; 168 | margin-left: 10px; 169 | } 170 | 171 | .section .title { 172 | font-weight: bold; 173 | font-size: 16px; 174 | } 175 | 176 | .section .important { 177 | text-decoration: underline; 178 | } 179 | 180 | .section.header { 181 | text-align: center; 182 | font-size: 12px; 183 | padding-top: 10px; 184 | border-top: none; 185 | } 186 | 187 | .section.footer { 188 | text-align: center; 189 | font-size: 12px; 190 | padding-top: 10px; 191 | } 192 | 193 | /* -- Social ---------------------------------- */ 194 | 195 | .social .social-button { 196 | display: inline-block; 197 | width: 100px; 198 | text-align: left; 199 | overflow: hidden; 200 | } 201 | .social .social-button.google-plus-one-button, 202 | .social .social-button.hacker-news-submit-button { 203 | width: 80px; 204 | } 205 | .social .social-button.github-follow-button, 206 | .social .social-button.twitter-follow-button { 207 | width: 170px; 208 | height: auto; 209 | } 210 | .social .social-button.reddit-submit-button { 211 | width: 140px; 212 | } 213 | .social .social-button.reddit-submit-button iframe { 214 | padding-top: 3px; 215 | } 216 | -------------------------------------------------------------------------------- /src/static/styles/style.css: -------------------------------------------------------------------------------- 1 | @import url("../vendor/yui-cssreset.css"); 2 | @import url("./generic.css"); 3 | 4 | .demo a { 5 | cursor: pointer; 6 | color: blue; 7 | display: block; 8 | margin-bottom: 5px; 9 | } 10 | .demo a:hover { 11 | text-decoration: underline; 12 | } 13 | 14 | .demo-pieces { 15 | width: 500px; 16 | height: 200px; 17 | overflow: scroll; 18 | border: 5px ridge white; 19 | } 20 | 21 | .demo-pieces div { 22 | width: 90%; 23 | height: 300px; 24 | padding: 15px 4%; 25 | } 26 | -------------------------------------------------------------------------------- /src/static/vendor/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; padding: 0.5em; 9 | color: #333; 10 | background: #f8f8f8 11 | } 12 | 13 | .hljs-comment, 14 | .hljs-template_comment, 15 | .diff .hljs-header, 16 | .hljs-javadoc { 17 | color: #998; 18 | font-style: italic 19 | } 20 | 21 | .hljs-keyword, 22 | .css .rule .hljs-keyword, 23 | .hljs-winutils, 24 | .javascript .hljs-title, 25 | .nginx .hljs-title, 26 | .hljs-subst, 27 | .hljs-request, 28 | .hljs-status { 29 | color: #333; 30 | font-weight: bold 31 | } 32 | 33 | .hljs-number, 34 | .hljs-hexcolor, 35 | .ruby .hljs-constant { 36 | color: #099; 37 | } 38 | 39 | .hljs-string, 40 | .hljs-tag .hljs-value, 41 | .hljs-phpdoc, 42 | .tex .hljs-formula { 43 | color: #d14 44 | } 45 | 46 | .hljs-title, 47 | .hljs-id, 48 | .coffeescript .hljs-params, 49 | .scss .hljs-preprocessor { 50 | color: #900; 51 | font-weight: bold 52 | } 53 | 54 | .javascript .hljs-title, 55 | .lisp .hljs-title, 56 | .clojure .hljs-title, 57 | .hljs-subst { 58 | font-weight: normal 59 | } 60 | 61 | .hljs-class .hljs-title, 62 | .haskell .hljs-type, 63 | .vhdl .hljs-literal, 64 | .tex .hljs-command { 65 | color: #458; 66 | font-weight: bold 67 | } 68 | 69 | .hljs-tag, 70 | .hljs-tag .hljs-title, 71 | .hljs-rules .hljs-property, 72 | .django .hljs-tag .hljs-keyword { 73 | color: #000080; 74 | font-weight: normal 75 | } 76 | 77 | .hljs-attribute, 78 | .hljs-variable, 79 | .lisp .hljs-body { 80 | color: #008080 81 | } 82 | 83 | .hljs-regexp { 84 | color: #009926 85 | } 86 | 87 | .hljs-symbol, 88 | .ruby .hljs-symbol .hljs-string, 89 | .lisp .hljs-keyword, 90 | .tex .hljs-special, 91 | .hljs-prompt { 92 | color: #990073 93 | } 94 | 95 | .hljs-built_in, 96 | .lisp .hljs-title, 97 | .clojure .hljs-built_in { 98 | color: #0086b3 99 | } 100 | 101 | .hljs-preprocessor, 102 | .hljs-pragma, 103 | .hljs-pi, 104 | .hljs-doctype, 105 | .hljs-shebang, 106 | .hljs-cdata { 107 | color: #999; 108 | font-weight: bold 109 | } 110 | 111 | .hljs-deletion { 112 | background: #fdd 113 | } 114 | 115 | .hljs-addition { 116 | background: #dfd 117 | } 118 | 119 | .diff .hljs-change { 120 | background: #0086b3 121 | } 122 | 123 | .hljs-chunk { 124 | color: #aaa 125 | } 126 | -------------------------------------------------------------------------------- /src/static/vendor/yui-cssreset.css: -------------------------------------------------------------------------------- 1 | /* 2 | YUI 3.10.0 (build a03ce0e) 3 | Copyright 2013 Yahoo! Inc. All rights reserved. 4 | Licensed under the BSD License. 5 | http://yuilibrary.com/license/ 6 | */ 7 | 8 | /* 9 | TODO will need to remove settings on HTML since we can't namespace it. 10 | TODO with the prefix, should I group by selector or property for weight savings? 11 | */ 12 | html{ 13 | color:#000; 14 | background:#FFF; 15 | } 16 | /* 17 | TODO remove settings on BODY since we can't namespace it. 18 | */ 19 | /* 20 | TODO test putting a class on HEAD. 21 | - Fails on FF. 22 | */ 23 | body, 24 | div, 25 | dl, 26 | dt, 27 | dd, 28 | ul, 29 | ol, 30 | li, 31 | h1, 32 | h2, 33 | h3, 34 | h4, 35 | h5, 36 | h6, 37 | pre, 38 | code, 39 | form, 40 | fieldset, 41 | legend, 42 | input, 43 | textarea, 44 | p, 45 | blockquote, 46 | th, 47 | td { 48 | margin:0; 49 | padding:0; 50 | } 51 | table { 52 | border-collapse:collapse; 53 | border-spacing:0; 54 | } 55 | fieldset, 56 | img { 57 | border:0; 58 | } 59 | /* 60 | TODO think about hanlding inheritence differently, maybe letting IE6 fail a bit... 61 | */ 62 | address, 63 | caption, 64 | cite, 65 | code, 66 | dfn, 67 | em, 68 | strong, 69 | th, 70 | var { 71 | font-style:normal; 72 | font-weight:normal; 73 | } 74 | 75 | ol, 76 | ul { 77 | list-style:none; 78 | } 79 | 80 | caption, 81 | th { 82 | text-align:left; 83 | } 84 | h1, 85 | h2, 86 | h3, 87 | h4, 88 | h5, 89 | h6 { 90 | font-size:100%; 91 | font-weight:normal; 92 | } 93 | q:before, 94 | q:after { 95 | content:''; 96 | } 97 | abbr, 98 | acronym { 99 | border:0; 100 | font-variant:normal; 101 | } 102 | /* to preserve line-height and selector appearance */ 103 | sup { 104 | vertical-align:text-top; 105 | } 106 | sub { 107 | vertical-align:text-bottom; 108 | } 109 | input, 110 | textarea, 111 | select { 112 | font-family:inherit; 113 | font-size:inherit; 114 | font-weight:inherit; 115 | } 116 | /*to enable resizing for IE*/ 117 | input, 118 | textarea, 119 | select { 120 | *font-size:100%; 121 | } 122 | /*because legend doesn't inherit in IE */ 123 | legend { 124 | color:#000; 125 | } 126 | 127 | /* YUI CSS Detection Stamp */ 128 | #yui3-css-stamp.cssreset { display: none; } 129 | --------------------------------------------------------------------------------