Skip to content

Commit

Permalink
update popcorn with my recent changes
Browse files Browse the repository at this point in the history
- incorporates various fixes from several PR's, cf:
  - menismu/popcorn-js#73
  - menismu/popcorn-js#75
  - menismu/popcorn-js#76
  • Loading branch information
titaniumbones committed Mar 11, 2019
1 parent d6502de commit fc47bde
Showing 1 changed file with 4 additions and 194 deletions.
198 changes: 4 additions & 194 deletions js/popcorn-complete.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* popcorn.js version 0e8ee55
* popcorn.js version a483a1d
* http://popcornjs.org
*
* Copyright 2011, Mozilla Foundation
Expand Down Expand Up @@ -102,7 +102,7 @@
};

// Popcorn API version, automatically inserted via build system.
Popcorn.version = "0e8ee55";
Popcorn.version = "a483a1d";

// Boolean flag allowing a client to determine if Popcorn can be supported
Popcorn.isSupported = true;
Expand Down Expand Up @@ -7599,196 +7599,6 @@ api - https://github.com/documentcloud/document-viewer/blob/master/public/javasc

});
})( Popcorn );
// PLUGIN: Google Feed
(function ( Popcorn ) {

var i = 1,
scriptLoaded = false;

/**
* googlefeed popcorn plug-in
* Adds a feed from the specified blog url at the target div
* Options parameter will need a start, end, target, url and title
* -Start is the time that you want this plug-in to execute
* -End is the time that you want this plug-in to stop executing
* -Target is the id of the DOM element that you want the map to appear in. This element must be in the DOM
* -Url is the url of the blog's feed you are trying to access
* -Title is the title of the blog you want displayed above the feed
* -Orientation is the orientation of the blog, accepts either Horizontal or Vertical, defaults to Vertical
* @param {Object} options
*
* Example:
var p = Popcorn("#video")
.googlefeed({
start: 5, // seconds
end: 15, // seconds
target: "map",
url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml",
title: "Planet Feed"
} )
*
*/

Popcorn.plugin( "googlefeed", function( options ) {

var dynamicFeedLoad = function() {
var dontLoad = false,
k = 0,
links = document.getElementsByTagName( "link" ),
len = links.length,
head = document.head || document.getElementsByTagName( "head" )[ 0 ],
css = document.createElement( "link" ),
resource = "//www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.";

if ( !window.GFdynamicFeedControl ) {

Popcorn.getScript( resource + "js", function() {
scriptLoaded = true;
});

} else {
scriptLoaded = true;
}

// Checking if the css file is already included
for ( ; k < len; k++ ){
if ( links[ k ].href === resource + "css" ) {
dontLoad = true;
}
}

if ( !dontLoad ) {
css.type = "text/css";
css.rel = "stylesheet";
css.href = resource + "css";
head.insertBefore( css, head.firstChild );
}
};

if ( !window.google ) {

Popcorn.getScript( "//www.google.com/jsapi", function() {

google.load( "feeds", "1", {

callback: function () {

dynamicFeedLoad();
}
});
});

} else {
dynamicFeedLoad();
}

// create a new div and append it to the parent div so nothing
// that already exists in the parent div gets overwritten
var newdiv = document.createElement( "div" ),
target = document.getElementById( options.target ),
initialize = function() {
//ensure that the script has been loaded
if ( !scriptLoaded ) {
setTimeout( function () {
initialize();
}, 5 );
} else {
// Create the feed control using the user entered url and title
options.feed = new GFdynamicFeedControl( options.url, newdiv, {
vertical: options.orientation.toLowerCase() === "vertical" ? true : false,
horizontal: options.orientation.toLowerCase() === "horizontal" ? true : false,
title: options.title = options.title || "Blog"
});
}
};

// Default to vertical orientation if empty or incorrect input
if( !options.orientation || ( options.orientation.toLowerCase() !== "vertical" &&
options.orientation.toLowerCase() !== "horizontal" ) ) {
options.orientation = "vertical";
}

newdiv.style.display = "none";
newdiv.id = "_feed" + i;
newdiv.style.width = "100%";
newdiv.style.height = "100%";
i++;

target && target.appendChild( newdiv );

initialize();

options.toString = function() {
return options.url || options._natives.manifest.options.url[ "default" ];
};

return {
/**
* @member webpage
* The start function will be executed when the currentTime
* of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ){
newdiv.setAttribute( "style", "display:inline" );
},
/**
* @member webpage
* The end function will be executed when the currentTime
* of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ){
newdiv.setAttribute( "style", "display:none" );
},
_teardown: function( options ) {
document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( newdiv );
delete options.feed;
}
};
},
{
about: {
name: "Popcorn Google Feed Plugin",
version: "0.1",
author: "David Seifried",
website: "dseifried.wordpress.com"
},
options: {
start: {
elem: "input",
type: "number",
label: "Start"
},
end: {
elem: "input",
type: "number",
label: "End"
},
target: "feed-container",
url: {
elem: "input",
type: "url",
label: "Feed URL",
"default": "http://planet.mozilla.org/rss20.xml"
},
title: {
elem: "input",
type: "text",
label: "Title",
"default": "Planet Mozilla",
optional: true
},
orientation: {
elem: "select",
options: [ "Vertical", "Horizontal" ],
label: "Orientation",
"default": "Vertical",
optional: true
}
}
});
})( Popcorn );

// PLUGIN: Google Maps
var googleCallback;
Expand Down Expand Up @@ -7818,7 +7628,7 @@ var googleCallback;
// for some reason the Google Map API adds content to the body
if ( document.body ) {
_mapFired = true;
Popcorn.getScript( "https://maps.googleapis.com/maps/api/js&key="+apiKey+"&callback=googleCallback" );
Popcorn.getScript( "https://maps.googleapis.com/maps/api/js?key="+apiKey+"&callback=googleCallback&libraries=geometry");
} else {
setTimeout(function () {
loadMaps();
Expand Down Expand Up @@ -10102,7 +9912,7 @@ var wikiCallback;
};

if ( options.src ) {
Popcorn.getScript( "//" + options.lang + ".wikipedia.org/w/api.php?action=parse&props=text&redirects&page=" +
Popcorn.getScript( "//" + options.lang + ".wikipedia.org/w/api.php?action=parse&prop=text&redirects&page=" +
options.src.slice( options.src.lastIndexOf( "/" ) + 1 ) + "&format=json&callback=wikiCallback" + _guid );
}

Expand Down

0 comments on commit fc47bde

Please sign in to comment.