Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

error in Typed.js integration module for SugarCube 2

edited December 2015 in Help! with 2.0
dont know why this happen even in newly fresh story, nothing add to it except story javscript and 1 random passage

here's my story javascript
/*! typed.js integration module for SugarCube */
!function(){"use strict";var getInlineOptions=function(classNames){var match,options={},typedRe=/^typed(?:-(\w+))+\b$/,parseRe=/-(speed|delay)(\d+)\b/g;if("typed"!==classNames){classNames=classNames.toLowerCase().split(/\s+/);for(var i=0;i<classNames.length;i++)if(typedRe.test(classNames[i])){for(;null!==(match=parseRe.exec(classNames[i]));)switch(match[1]){case"speed":options.typeSpeed=+match[2];break;case"delay":options.startDelay=+match[2]}break}}return options},typedCallbackFactory=function(el,callback){return function(){var $outer=jQuery(el),$inner=jQuery('<div class="typedjs-text-wrapper" style="display:block;position:absolute;left:0;top:0;"><span class="typed"></span></div>'),$source=$outer.children('[class|="typed"]'),options=jQuery.extend({typeSpeed:40,startDelay:400},getInlineOptions($source.attr("class")),{strings:[$source.html()]});"function"==typeof callback&&(options.callback=callback),$outer.append($inner),$inner.children().typed(options)}};postrender.typedSetupHandler=function(content){jQuery('[class|="typed"]',content).addClass("typed").css("visibility","hidden").wrap('<div class="typedjs-outer-wrapper" style="display:block;position:relative;"></div>')},postdisplay.typedAnimationHandler=function(){for(var $elements=jQuery("#passages .typedjs-outer-wrapper"),callback=null,i=$elements.length-1;i>=0;--i)callback=typedCallbackFactory($elements[i],callback);"function"==typeof callback&&callback()}}();

and here in random passage to test TME instruction for typed.js
@ !!Instructions for SugarCube The integration module will run Typed.js on any element with the class {{{typed}}}, so you may use either HTML markup or the [[custom styles markup|http://www.motoslave.net/sugarcube/2/docs/markup.html#custom-styles]]. Additionally, you may append optional components to the {{{typed}}} class, separated by hyphens, which control various aspects of the typing animation: {{{ speed# Typing speed (in ms; default: 40). delay# Delay before typing starts (in ms; default: 400). }}} !!Class Name Examples Basic example, speed and delay at defaults: {{{ typed }}} To set the typing speed to 80ms: {{{ typed-speed80 }}} To delay the start of typing for 800ms: {{{ typed-delay800 }}} To set the typing speed to 80ms and delay the start of typing for 800ms: {{{ typed-speed80-delay800 }}} !!See Also Obviously, check out the source of the Start passage, Story JavaScript, and Story Stylesheet.

error still happen and Twine 2.0.10 constantly apologizing to me because of it :) , do i'm doing wrong ? or is it a bug ? any help will be appreciated. thx before

Comments

  • edited December 2015
    Info: The error message produced by the above example is:
    $inner.children(...).typed is not a function

    edit: Where are you getting the SugarCube related instruction for typed.js from, they don't appear to be on the SugarCube 2 website.
  • edited December 2015
    i get from here http://twinery.org/forum/discussion/comment/10872/#Comment_10867

    everyone said it's works but not for me, dunno what's missing
  • edited December 2015
    WOOOOPPSSSS , its seem i must add typed.js itself in story javascript because Typed.js integration module itself its not enough LOL

    works like a charm !!

  • Yes, as you worked out the Typed.js integration module is used to integrate the Typed.js jQuery plugin into SugarCube.
  • From the very post you linked:
    […] they include everything you should need: Typed.js, the integration module, styles, a demo, and instructions.
    Yes, the Typed.js library itself is actually necessary.
Sign In or Register to comment.