Skip to content

{ Category Archives } Javascript

Using tagged template literals, revisted

I thought I had a clever way of using tagged template literals with Array.prototype.reduce, but it turns out that String.raw does this already. So my template function should be: function template(strings, ...keys) { return (data) => String.raw( {raw: strings, ...keys.map (key => data[key]) ); } Which is much simpler

Using tagged template literals

This seems obvious in retrospect, but I got this from Olivier Wietrich's tag-reduce. Tagged Literal Templates are useful syntactic sugar. I fill out a lot of school physical forms (each school has its own form), so I need strings like `Weight: ${data.wt_lb} pounds (${data.wt_kg} kg), ${data.wt_pct} percentile`. That works fine if I am evaluating the […]

Updated bililiteRange

It seems like a long time ago that I started updating bililiteRange but it was only 3 months ago. And I think I'm done (though projects are never done!). bililiteRange 3.2 is released, and requires history.js, toolbar.js, jquery.status.js and jquery.keymap.js for all the functionality, though really the core only requires history.js. The documentation is at […]

Prism on a CDN

This is something I didn't know about: Prism, the syntax highlighter I use, is available from a few free CDN's, so I don't have to host it. Cool!

Moving bililiteRange into the modern age.

I haven't updated bililiteRange for years, but it's time to drop support for Internet Explorer and use modern constructs like Promise and input events. It should make things more simple. From here on in, I will only support Chrome, Firefox and Edge (the chromium-based one; I don't have Edge Legacy. I'm also working on moving […]

New flexcal

After some prompting by those actually using it, I paid more attention to my flexcal date picker plugin, adding features like buttons, drop-down menus and formatted dates. The documentation is on my github pages at github.bililite.com/flexcal, and the code is on github at github.com/dwachss/flexcal. All other posts about it are obsolete. The current stable version […]

New jquery.ui.subclass.js

I finally updated my jQuery widget subclassing code to use the newest version of jQuery UI, which incorporated a lot of the original ideas I outlined back in 2010. The new documentation is now on my github pages, and I've updated the flexcal posts to reflect it. It is a breaking change; instead of $.namespace.widgetname.subclass('namespace.newwidgetname', […]

New jQuery plugins, $.repo and $.getScripts

See the code. jQuery plugin to allow using cdn.rawgit.com to get the latest commit of a github repo github won't let you hotlink to their site directly; raw.githubusercontent.com sends its content with a X-Content-Type-Options:nosniff header, so modern browsers won't accept it as javascript. http://rawgit.com gets around that by pulling the raw file and re-serving it […]

Improved flexcal

Two new additions to flexcal, which is now at version 2.2. See the code and a demo, that uses my new github pages. Mouse Wheel The calendar now responds to wheel events, changing the month with scroll up/down and changing the calendar tab with scroll left/right. I initially tried to throttle it since my trackpad […]

Updated $.fn.status

I've added the ability to use the console with my status plugin, so you can do $(console).status({ run: $.post(url, {data: data}).then( function() { return 'Data Saved' }, function() { return new Error('Data Not saved') } ) }); And the output will go to the console rather than to an element on the page. For simple […]