0.0.4 • Published 10 years ago

scribe-plugin-vimeo-prompt-command v0.0.4

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

Scribe Vimeo prompt plugin

Plugin to create embedded Vimeo iframe players in scribe. Plase make sure to validate urls and properties of the iframe on SERVER if you are dealing with untrusted content

Installation

Using npm npm install --save scribe-plugin-vimeo-prompt-command

Using bower bower install --save scribe-plugin-vimeo-prompt-command

I may actually provide a release builds outside of npm/bower if somebody will show an interest.

Usage

Can be required with browserify, used as AMD or included in script. npm version will not work with last two

Example

/**
 * The plugin intitialization
 * @param    {Object}   options  Options that will be pased
 * @param    {Function} jsonp    JSONP handler function
 * @optional {Function} prompt   custom prompt handler
 * @return   {Function}          scribe plugin
 */
var vimeoPrompt = require('scribe-plugin-vimeo-prompt-command');
scribe.use(scribePluginVimeo({ maxwidth: 300 }, jsonp, prompt);

/**
 * Executes jsonp request to vimeo oEmbed API
 * @param  {String}   vimeoUrl  Url to which the GET request should be done
 * @param  {Object}   options   Options that should be serialzed
 * @param  {Function} callback  To be called with response after the request is done
 */
function jsonp (vimeoUrl, options, callback) {
    // Use whatever method you want I prefer jQuery
    jQuery.getJSON(vimeoUrl, options, function (data) {
        callback(data);
    });
}

/**
 * Custom url prompt handler. Will be shown when command is
 * executed
 * @return {String|Object} Url or Options object
 */
function prompt() {
    // Simple url
    return window.prompt('Enter url');
}
// or ---
function prompt() {
    // More settings from user
    return {
        url:   // from your prompt
        width: // from your prompt
    }
}
0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago