Skip to content

Instantly share code, notes, and snippets.

View ChapelR's full-sized avatar

Chapel ChapelR

View GitHub Profile
(() => {
"use strict";
function bindEvent (self) {
let $element = self.args[0] && typeof self.args[0] && $(self.args[0].trim());
if (!$element || !($element instanceof $) || !$element[0]) {
$element = $(self.output);
}
$element.ariaClick(self.createShadowWrapper(() => {
$.wiki(self.payload[0].contents);
}));
@ChapelR
ChapelR / log.css
Last active February 21, 2021 10:15
expanding log
[data-tags~="show-log"] #passages {
margin-bottom: 5em;
}
#log {
position: fixed;
height: 4em;
padding: 1em 4em 0 4em;
z-index: 1;
bottom: 0;
@ChapelR
ChapelR / README.md
Last active September 14, 2020 05:38
Newbie Guide for tw-analytics

This document originally written by Somnium. Thank you for your contribution!

If you are a beginner Twine user and want a little extra help, here is a step-by-step guide for using TW-Analytics to add Google Analytics to your story.

For WINDOWS:

  1. This requires NodeJS; go to this address and install the "LTS" release: https://nodejs.org/en/
  2. Wait for Node.js to finish installing. You will probably need to reboot your PC.
  3. Open the win command prompt (either search for "cmd" in the start menu or presss WIN KEY + R and type cmd and press enter)
  4. The command prompt will open. Type npm i -g tw-analytics and press enter.
@ChapelR
ChapelR / gist:bcbcb08d3db2a1df60c16de73344ee20
Last active May 9, 2021 17:49
Harlowe DM Loading patch
// goes in story JS; see conversation below;
// only games played via Twine 2 (web)'s play/test modes have the bug
delete Map.prototype.toJSON; delete Set.prototype.toJSON;
@ChapelR
ChapelR / typed.min.js
Created June 11, 2020 10:02
typed.js + speechbox
// Tweaked for the speechbox macro set by Thomas Michael Edwards
/*! typed.js integration module for SugarCube */
!function(){"use strict";function getInlineOptions(classNames){var options={},typedRe=/^typed(?:-(\w+))+\b$/,parseRe=/-(speed|delay)(\d+)\b/g,match=void 0;if("typed"!==classNames)for(var classOpts=classNames.toLowerCase().split(/\s+/),i=0;i<classOpts.length;++i)if(typedRe.test(classOpts[i])){for(;null!==(match=parseRe.exec(classOpts[i]));)switch(match[1]){case"speed":options.typeSpeed=Number(match[2]);break;case"delay":options.startDelay=Number(match[2])}break}return options}function typedCallbackFactory(el,callback){return function(){var $outer=jQuery(el),$inner=jQuery('<div class="typedjs-text-wrapper"><span class="typed"></span></div>'),$source=$outer.children('[class|="typed"]'),options=jQuery.extend({strings:["^0 "+$source.html()],typeSpeed:40,startDelay:400,onComplete:function(){$inner.children(".typed-cursor").remove(),callback()},preStringTyped:function(){jQuery.event.trigger(":typedstart"
@ChapelR
ChapelR / README.md
Last active January 23, 2020 04:31
Say and Character Macro Set

<<character name imageSrc>> / setup.addCharacter(name, imageSrc)

Add character names to associate with image sources (as URLs). Must be done in StoryInit or the Story JavaScript area. Character names become macros later.

<<say name imageSrc>>...<</say>> / setup.say(outputElement, characterName, text, imageSrc)

Create a speech box with the given character name and image, which says the indicated text content.

Character Name Macros

@ChapelR
ChapelR / continue.js
Last active December 26, 2019 23:24
Continue macros.
(function () {
'use strict';
// selectors to ignore
var ignored = ['a', ':button', '*[role="button"]', '.continue-macro-ignore', '#ui-bar', '#ui-dialog'];
function ignoreMe () {
$(document).on('click.continue-macro keyup.continue-macro', ignored.join(', '), function (ev) {
ev.stopPropagation();
});
@ChapelR
ChapelR / README.md
Created December 3, 2019 09:16 — forked from jsoma/README.md
Installing tweego and story-formats on OS X.

Installing tweego is a little more complicated than (I think) it should be, so here's a script to do it for you. If you'd like to one-line it, you can just cut and paste this in Terminal:

curl https://gist.githubusercontent.com/jsoma/5ef3045b2004a610455f371479a6f0cf/raw/bebb34dd808a1703dd37df1fc14fee04685776f2/tweego.sh | bash

Once it's installed, tweego docs are here. You'll probably want to read these twee docs, too.

@ChapelR
ChapelR / README.md
Created December 3, 2019 09:16 — forked from jsoma/README.md
Installing tweego and story-formats on OS X.

Installing tweego is a little more complicated than (I think) it should be, so here's a script to do it for you. If you'd like to one-line it, you can just cut and paste this in Terminal:

curl https://gist.githubusercontent.com/jsoma/5ef3045b2004a610455f371479a6f0cf/raw/bebb34dd808a1703dd37df1fc14fee04685776f2/tweego.sh | bash

Once it's installed, tweego docs are here. You'll probably want to read these twee docs, too.

@ChapelR
ChapelR / README.md
Last active July 10, 2019 03:06
article macro and function

USAGE

Install

Copy articles.min.js or artciles.js (former should be preferred for most users) into story JavaScript or equivalent.

Macros <<a>>, <<an>>, <<A>>, and <<An>>

&lt;<a word="">&gt;</a>