Skip to content

Instantly share code, notes, and snippets.

View baldwicc's full-sized avatar

Chris Baldwin baldwicc

View GitHub Profile
@baldwicc
baldwicc / qut-jqueryqueue.js
Last active October 23, 2018 06:39
Loads jQuery asynchronously, then executes queue of functions from an array. After queue is flushed, functions .push()'d to the queue will execute immediately.
/**
* qut-jqueryqueue
* @author Christopher Baldwin [https://staff.qut.edu.au/details?id=baldwicc]
* @licence Simplified BSD License
* @source https://gist.github.com/baldwicc/6315577
*/
/*
Exaple of usage:
@baldwicc
baldwicc / qut-stickyfooter.js
Last active December 21, 2015 20:39
Stick Footer for Blackboard Learn
/**
* qut-stickyfooter
* @author Christopher Baldwin [https://staff.qut.edu.au/details?id=baldwicc]
* @licence Simplified BSD License
* @source https://gist.github.com/baldwicc/6362546
*/
/*
Usage:
- Point options.csspath at a stylesheet, and edit html.footer as appropriate
@baldwicc
baldwicc / qut-pagetitles.js
Last active December 21, 2015 20:39
PRD: Topframe Hacks for Bb Learn. Customises page titles, sets a frameset-wrapped url of current content page location in the address bar, and customises banner to open in same window.
/* jshint strict: false */
/* global Event, $$ */
/**
* qut-pagetitles
* @author Christopher Baldwin [https://staff.qut.edu.au/details?id=baldwicc]
* @license Simplified BSD License
* @source [https://gist.github.com/baldwicc/6362607]
*/
/*
Usage:
@baldwicc
baldwicc / qut-inlinewarnings.js
Last active December 21, 2015 22:09
Adds a native lightbox based on url regex, or a native inline messages based on matching css selectors. Useful when decommissioning tools.
/** qut-inlinewarnings
* Adds a native lightbox based on url regex, or a native inline messages based on matching css selectors. Useful when decommissioning tools.
*
* - Uses .html resources for lightbox iframes
* - Only shows lightbox once a day
* - Useful for building block pages, or standard pages with content items
* - Tracks to GA
*
* @author Christopher Baldwin [https://staff.qut.edu.au/details?id=baldwicc]
* @licence Simplified BSD License
@baldwicc
baldwicc / qut-bbcssfix.js
Last active December 22, 2015 03:29
Forcibly reloads CSS files if it appears that they didn't load correctly, when given a specific HTML element and a bad (and/or good) css rule to check against.
/**
* qut-bbcssfix
* @author Christopher Baldwin [https://staff.qut.edu.au/details?id=baldwicc]
* @licence Simplified BSD License
* @source https://gist.github.com/baldwicc/6410608
*/
/* Usage:
- Set elem_to_check and style_to_check to a style that doesn't appear to load correctly
- Set bad_value to the default css rule applied to this element (eg: "none")
@baldwicc
baldwicc / detect-ie.js
Last active December 24, 2015 01:19
Quick script to add is-ie, is-ie-8, and not-ie classes to a given list of selectors. Requires Prototype. HTML one-liner version provided that should cope with Bb 9.1sp9's text editor. - Leave VTBE on - Toggle HTML mode - Paste markup - Press submit (don't toggle html mode back off!!)
// <script type="text/javascript">
/**
* configurable options
* @type {object}
* @property {array} selectors array of selectors to add ie classes to
* @property {string} isie_prefix prefix for ie version class
* @property {string} isie class to add when browser is ie
* @property {string} not-ie class to add when browser is not ie
*/
@baldwicc
baldwicc / qut-clickyicons.html
Created October 16, 2013 08:38
Clickable Content Item Icons: Borrows the hyperlink from the content item title, clones it and wraps it around the content item's icon.
<script type="text/javascript" id="qut-clickyicons">
Event.observe(document,"dom:loaded", function() {
var contentitem_title_hyperlinks = $$('#content_listContainer > li > .item > h3 > a[href^="/webapps"]');
for (var i = 0; i < contentitem_title_hyperlinks.length; i++) {
var thislink = contentitem_title_hyperlinks[i];
var contentitem_icon = thislink.up('.item').previous('img.item_icon');
var newlink = thislink.clone(false);
contentitem_icon.wrap(newlink);
}
});
@baldwicc
baldwicc / qut-addscript.js
Created October 16, 2013 10:02
Adds script files <head> with a simple callback once loaded. (Note: Callback fired on 'load' event - not necessarily before / after actual execution)
var _qut = _qut || {};
_qut.addscript = function(src, fn) {
var head = $$("head")[0],
script = new Element('script', {
type: 'text/javascript',
async: true,
defer: true
}),
@baldwicc
baldwicc / qut-tii-defaults.js
Last active December 25, 2015 16:28
Turnitin Direct - Custom Defaults: Customises the default options when creating Turnitin Direct items.
/* global $$ */
/**
* qut-tii-defaults
* @author Christopher Baldwin [https://staff.qut.edu.au/details?id=baldwicc]
* @license Simplified BSD License
* @source [https://gist.github.com/baldwicc/7005606]
*/
Event.observe(document, 'dom:loaded', function () {
var conf = {
@baldwicc
baldwicc / solarized_setup.js
Last active February 9, 2024 15:38
Solarized Light and Solarized Dark for Chrome Secure Shell (nassh), with fonts
/**
* STEP 1: Setup
* - Open Chrome Secure Shell settings
* - Open JS Console (CTRL+SHIFT+J)
* - Copy and paste the following:
*/
var s7d_colours = {
'base03': '#002b36',
'base02': '#073642',
'base01': '#586e75',