Builds using Babel, and runs a local micro-server for the demo
You can 'make serve' if you want to see the example. Works will with jQuery 2.*. Modified to use jQueryUI's easing instead of the standalone; in which case, it's entirely dependent upon the jQuery CDN; no more shipping with the libraries embedded.
This commit is contained in:
parent
a5ceb5e25e
commit
a40a0da7cb
|
@ -6,3 +6,4 @@
|
|||
\#*
|
||||
node_modules/*
|
||||
es5/*
|
||||
htdocs/*
|
||||
|
|
11
Makefile
11
Makefile
|
@ -7,14 +7,19 @@ all: es5 es5/sitedarts.js
|
|||
es5:
|
||||
mkdir -p es5
|
||||
|
||||
es5/sitedarts.js: es5 node_modules/babel-cli
|
||||
htdocs:
|
||||
mkdir -p htdocs
|
||||
|
||||
es5/sitedarts.js: es5 node_modules/babel-cli es6/sitedarts.js
|
||||
./node_modules/babel-cli/bin/babel.js -o es5/sitedarts.js es6/sitedarts.js
|
||||
|
||||
node_modules/http-server node_modules/babel-cli:
|
||||
npm install
|
||||
|
||||
serve: node_modules/http-server es5/sitedarts.js
|
||||
./node_modules/http-server/bin/http-server .
|
||||
serve: node_modules/http-server es5/sitedarts.js htdocs
|
||||
cp -R examples/* htdocs/
|
||||
cp -R es5 htdocs/
|
||||
./node_modules/http-server/bin/http-server htdocs/
|
||||
|
||||
clean:
|
||||
rm -fr es5
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
* Requires: jQuery v1.3.2 or later
|
||||
*/
|
||||
|
||||
|
||||
;(function($) {
|
||||
$.fn.siteDarts = (options) => {
|
||||
$.fn.siteDarts = function(options) {
|
||||
return this.each(() => {
|
||||
options = $.extend(true, {}, $.fn.siteDarts.defaults, options);
|
||||
var names = $('a[name]');
|
||||
|
@ -21,7 +20,7 @@
|
|||
var prop = $(window).height();
|
||||
var doch = $(document).height();
|
||||
|
||||
names.each((dex) => {
|
||||
names.each(function(dex) {
|
||||
var n = $(this).attr('name');
|
||||
var d = $(this).offset().top;
|
||||
$("li." + options.markitem + ' a[href="#' + n + '"]')
|
||||
|
@ -35,7 +34,7 @@
|
|||
$('#' + options.marklist).remove();
|
||||
}
|
||||
var l = $('<ul id="' + options.marklist + '"></ul>').appendTo('body');
|
||||
names.each(() => {
|
||||
names.each(function() {
|
||||
var o = $('<li class="' + options.markitem + '"><a href="#' +
|
||||
$(this).attr('name') + '">' + $(this).text() + '</a></li>').appendTo(l);
|
||||
|
||||
|
|
1422
examples/index.html
1422
examples/index.html
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue