Snapchat StoryOptions

@class
@param {string} text
@param {number} timer
@param {boolean} cameraFrontFacing
18054
function StoryOptions (text, timer, cameraFrontFacing) {
  var self = this
  if (!(self instanceof StoryOptions)) return new StoryOptions(text, timer, cameraFrontFacing)

  self.text = text
  self.timer = timer || 3
  self.cameraFrontFacing = !!cameraFrontFacing
}
835927
function Story (client, params) {
  var self = this
  if (!(self instanceof Story)) return new Story(client, params)
  if (!(client instanceof Snapchat)) throw new Error('invalid client')

  self.client = client

  // null until you call load
  // self.blob = null

  // null until you call loadThumbnail
  // self.thumbnailBlob = null

  self.author = params['username']
  self.viewed = !!params['viewed']
  self.shared = !!params['is_shared']
  self.zipped = !!params['zipped']
  self.matureContent = !!params['mature_content']
  self.needsAuth = !!params['needs_auth']

  self.duration = params['time'] || 0

  self.identifier = params['id']
  self.text = params['caption_text_display']
  self.clientIdentifier = params['client_id']

  if (params['story_filter_id'].length) {
    self.storyFilterIdentifier = params['story_filter_id']
  }
  self.adCanFollow = !!params['ad_can_follow']

  self.mediaIdentifier = params['media_id']
  self.mediaIV = params['media_iv']
  self.mediaKey = params['media_key']
  self.mediaKind = params['media_type'] || 0
  self.mediaURL = params['media_url']

  self.thumbIV = params['thumbnail_iv']
  self.thumbURL = params['thumbnail_url']

  self.timeLeft = params['time_left'] || 0
  self.created = new Date(+params['timestamp']).toISOString()
}
805014
function () {
        window.removeEventListener("focus", savePhotoOnFocus);
        // call only when the app is in focus again
        savePhoto(cameraPicture, {
            destinationType: destinationType,
            targetHeight: targetHeight,
            targetWidth: targetWidth,
            encodingType: encodingType,
            saveToPhotoAlbum: saveToPhotoAlbum
        }, successCallback, errorCallback);
    }
363791
function msGotPointerCapture(inEvent) {
  const e = this.dispatcher.makeEvent('gotpointercapture', inEvent, inEvent);
  this.dispatcher.dispatchEvent(e);
}
1018569
function createStoryJS(c, src) {
  /* VARS
  ================================================== */
  var storyjs_embedjs, t, te, x,
    isCDN         = false,
    js_version        = "2.24",
    ready = {
      timeout:  "",
      checks:   0,
      finished: false,
      js:     false,
      css:    false,
      font: {
        css:  false
      }
    },
    path = {
      base:   embed_path,
      css:    embed_path + "css/",
      js:     embed_path + "js/",
      font: {
        google: false,
        css:  embed_path + "css/fonts/",
        js:   "//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"
      }
    },
    storyjs_e_config = {
      version:  js_version,
      debug:    false,
      type:   'timeline',
      id:     'storyjs',
      embed_id: 'timeline-embed',
      is_embed:   true,
      width:    '100%',
      height:   '100%',
      source:   'https://docs.google.com/spreadsheet/pub?key=0Agl_Dv6iEbDadFYzRjJPUGktY0NkWXFUWkVIZDNGRHc&output=html',
      lang:   'en',
      font:   'default',
      start_at_end: false,
      timenav_position: 'bottom',
      css:    path.css + 'timeline.css?'+js_version,
      js:     '',
      api_keys: {
        google:       "",
        flickr:       "",
        twitter:      ""
      },
      gmap_key:   ""
    }
  /* BUILD CONFIG
  ================================================== */
  if (typeof c == 'object') {
    for (x in c) {
      if (Object.prototype.hasOwnProperty.call(c, x)) {
        storyjs_e_config[x] = c[x];
      }
    }
  }

  if (typeof src != 'undefined') {
    storyjs_e_config.source = src;
  }

  /* CDN VERSION?
  ================================================== */
  if (typeof url_config == 'object') {
    isCDN = true;

    /* IS THE SOURCE GOOGLE SPREADSHEET WITH JUST THE KEY?
     * this is probably too clever a test but don't mess too much in case backwards compatibility
     * but we shouldn't put a rull URL into the key...
    ================================================== */
    if (!(storyjs_e_config.source.match("docs.google.com") 
        || storyjs_e_config.source.match("json$") 
        || storyjs_e_config.source.match("storify") 
        || storyjs_e_config.source.match("^http") 
      )) {
      storyjs_e_config.source = "https://docs.google.com/spreadsheet/pub?key=" + storyjs_e_config.source + "&output=html";
    }

  }

  /* DETERMINE TYPE
  ================================================== */
  if (storyjs_e_config.js.match("/")) {

  } else {
    storyjs_e_config.css  = path.css + storyjs_e_config.type + ".css?" + js_version;

    // Use unminified js file if in debug mode
    storyjs_e_config.js   = path.js  + storyjs_e_config.type;
    if (storyjs_e_config.debug) {
      storyjs_e_config.js += ".js?"  + js_version;
    } else {
      storyjs_e_config.js += "-min.js?"  + js_version;
    }

    storyjs_e_config.id   = "storyjs-" + storyjs_e_config.type;
  }

  /* PREPARE
  ================================================== */
  createEmbedDiv();

  /* Load CSS
  ================================================== */
  LoadLib.css(storyjs_e_config.css, onloaded_css);

  /* Load FONT
  ================================================== */
  if (storyjs_e_config.font == "default") {
    ready.font.css    = true;
  } else {
    // FONT CSS
    var fn;
    if (storyjs_e_config.font.match("/")) {
      fn        = storyjs_e_config.font.split(".css")[0].split("/");
      path.font.name  = fn[fn.length -1];
      path.font.css = storyjs_e_config.font;
    } else {
      path.font.name  = storyjs_e_config.font;
      path.font.css = path.font.css + "font."+storyjs_e_config.font.toLowerCase()+".css?" + js_version;
    }
    LoadLib.css(path.font.css, onloaded_font_css);
  }
    LoadLib.js(storyjs_e_config.js, onloaded_js);

  /* On Loaded
  ================================================== */

  function onloaded_js() {
    ready.js = true;
    onloaded_check();
  }

  function onloaded_css() {
    ready.css = true;
    onloaded_check();
  }
  function onloaded_font_css() {
    ready.font.css = true;
    onloaded_check();
  }
  function onloaded_check() {
    if (ready.checks > 40) {
      return;
      alert("Error Loading Files");
    } else {
      ready.checks++;
      if (ready.js && ready.css && ready.font.css) {
        if (!ready.finished) {
          ready.finished = true;
          buildEmbed();
        }
      } else {
        ready.timeout = setTimeout('onloaded_check_again();', 250);
      }
    }
  };
  this.onloaded_check_again = function() {
    onloaded_check();
  };

  /* Build Timeline
  ================================================== */
  function createEmbedDiv() {
    var embed_classname = "tl-timeline-embed";

    t = document.createElement('div');

    if (storyjs_e_config.embed_id != "") {
      te = document.getElementById(storyjs_e_config.embed_id);
    } else {
      te = document.getElementById("timeline-embed");
    }

    te.appendChild(t);
    t.setAttribute("id", storyjs_e_config.id);

    if (storyjs_e_config.width.toString().match("%") ) {
      te.style.width = storyjs_e_config.width.split("%")[0] + "%";
    } else {
      storyjs_e_config.width = storyjs_e_config.width - 2;
      te.style.width = (storyjs_e_config.width) + 'px';
    }

    if (storyjs_e_config.height.toString().match("%")) {
      te.style.height = storyjs_e_config.height;
      embed_classname += " tl-timeline-full-embed";
      te.style.height = storyjs_e_config.height.split("%")[0] + "%";

    } else if (storyjs_e_config.width.toString().match("%")) {
      embed_classname += " tl-timeline-full-embed";
      storyjs_e_config.height = storyjs_e_config.height - 16;
      te.style.height = (storyjs_e_config.height) + 'px';
    }else {
      embed_classname += " sized-embed";
      storyjs_e_config.height = storyjs_e_config.height - 16;
      te.style.height = (storyjs_e_config.height) + 'px';
    }

    te.setAttribute("class", embed_classname);
    te.setAttribute("className", embed_classname);
    t.style.position = 'relative';
  }

  function buildEmbed() {
    TL.debug = storyjs_e_config.debug;

    storyjs_e_config['ga_property_id'] = 'UA-27829802-4';
    storyjs_e_config.language = storyjs_e_config.lang;
    if (storyjs_e_config.width == '100%') {
      storyjs_e_config.is_full_embed = true;
    }
    window.timeline = new TL.Timeline('timeline-embed', storyjs_e_config.source, storyjs_e_config);

  }

}
168349
function Timer(timer, clear, duration, fn) {
          this.start = +(new Date());
          this.duration = duration;
          this.clear = clear;
          this.timer = timer;
          this.fns = [fn];
        }
990004
function(text) {
      this.history.commit();

      var start = select.cursorPos(this.container, true),
          end = select.cursorPos(this.container, false);
      if (!start || !end) return;

      end = this.replaceRange(start, end, text);
      select.setCursorPos(this.container, end);
      webkitLastLineHack(this.container);
    }
764237
protected void createLaunchOptionEditor(Composite parent, String text) {
		final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL);
		this.enableAssertionsInRunModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_2);
		this.enableAssertionsInRunModeButton.addSelectionListener(this.defaultListener);
		this.enableAssertionsInDebugModeButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_1);
		this.enableAssertionsInDebugModeButton.addSelectionListener(this.defaultListener);
		this.runInEclipseButton = createCheckButton(group, Messages.SARLMainLaunchConfigurationTab_0);
		this.runInEclipseButton.addSelectionListener(this.defaultListener);
	}
617917
function Timer (callback, start) {
  this.callback = callback;
  this.startDate = null;
  if (!exists(start) || start !== false) {
    this.start();
  }
}
383477
public void setFlipText(final String TEXT) {
        if (null == flipText) {
            _flipText = TEXT;
            if (!oldFlipText.equals(_flipText)) { fireTileEvent(FLIP_START_EVENT); }
            oldFlipText = _flipText;
        } else {
            flipText.set(TEXT);
        }
    }
768777
function Text(options) {

	this.__proto__ = new Control();

	this.init = function(options) {
		this.type = options.type = 'Text';
		this.parent = options.parent;
		this.defaults = {
			x:48, y:48,
			text: '',
			fill:this.parent.fill,
			fill_highlight: this.parent.lighter(this.parent.stroke),
			stroke: this.parent.stroke,
			'stroke-width': this.parent.control_stroke,
			fontsize: this.parent.fontsize,
			script: undefined,
			onload: undefined
		};
		this.setoptions(options);
		this.render();
		return this;
	};

	this.render = function() {
		this.label = this.parent.paper.text(this.x, this.y, this.text)
			.attr({fill:this.stroke, stroke:this.stroke, 'font-size': this.fontsize,
				'text-anchor': 'start'});	// http://stackoverflow.com/questions/2124763/raphael-js-and-text-positioning
		this.textelts.push(this.label);
		this.sethandlers();
	};

	this.move = function(newx, newy) {
		this.label.attr({x:this.x, y:this.y});
	};

	this.setValue = function(value) {
		this.value = value;
		this.label.attr({text: this.value});
		var update = {id: this.id, value: this.value};
		this.fire('update', update);
	};

	return this.init(options || {});
}
721222
def on_canvas_change(self, event):
        
        # Connect key events from canvas to camera. 
        # TODO: canvas should keep track of a single node with keyboard focus.
        if event.old is not None:
            event.old.events.key_press.disconnect(self.viewbox_key_event)
            event.old.events.key_release.disconnect(self.viewbox_key_event)
        if event.new is not None:
            event.new.events.key_press.connect(self.viewbox_key_event)
            event.new.events.key_release.connect(self.viewbox_key_event)
815402
function( element, type, handler, useCapture )
    {
        if( element.addEventListener ) {
            element.addEventListener( type, handler, useCapture ? true : false );
        }
        else if( element.attachEvent ) {
            element.attachEvent( 'on' + type, handler );
        }
        else if( element != window )
            element['on' + type] = handler;
    }
270376
function instagramify(parentNode, childNode, options, callback) {
    Embedo.utils.sdkReady('instagram', function (err) {
      if (err) {
        return callback(err);
      }
      if (!window.instgrm.Embeds || !window.instgrm.Embeds) {
        return callback(new Error('instagram_sdk_missing'));
      }

      window.instgrm.Embeds.process(childNode);
      var instagram_embed_timer = setInterval(handleInstagramRendered, 250);

      function handleInstagramRendered() {
        if (
          childNode.firstChild &&
          childNode.firstChild.className.match(/instagram-media-rendered/)
        ) {
          clearInterval(instagram_embed_timer);
          if (options.centerize !== false) {
            Embedo.utils.centerize(parentNode, childNode, options);
          }
          return automagic(parentNode, childNode, options, callback);
        }
      }
    });
  }
434273
function setupTimer(opts) {
                var name, timer;
                name = opts.name || node.game.timer.name;
                timer = node.timer.getTimer(name);

                if (!timer) {
                    node.warn('setup("timer"): timer not found: ' + name);
                    return false;
                }

                if (opts.options) timer.init(opts.options);

                switch (opts.action) {
                case 'start':
                    timer.start();
                    break;
                case 'stop':
                    timer.stop();
                    break;
                case 'restart':
                    timer.restart();
                    break;
                case 'pause':
                    timer.pause();
                    break;
                case 'resume':
                    timer.resume();
                }

                return true;
            }
1217898
def register_on_snapshot_taken(self, callback):
        
        event_type = library.VBoxEventType.on_snapshot_taken
        return self.event_source.register_callback(callback, event_type)
519859
function Parser(text) {
        if (typeof text !== 'string') {
            throw new Error('not a string');
        }
        this.text = text.trim();
        this.level = 0;
        this.place = 0;
        this.root = null;
        this.stack = [];
        this.currentObject = null;
        this.state = NEUTRAL;
    }