/*see playset.js in same dir for source*/ /* Copyright(c)2008-2017 Internet Archive. Software license AGPL version 3. */ 'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Class that iterates over A/V items, playing them in a playlist. // JS file can be added to a page and will try to find a place to append a "Play items" link. // Whatever items the user sees in their page, when they click "Play items", will get added to a new // playlist and their browser gets redirected to the first item. // After each item is finished playing, the browser will redirect to next item, until done. // User is free to move around the playlist at any time. // // xxx better theatre shift code? // xxx share/link as modal? // xxx cleanup/improve descriptions for description-less items? // convenient, no? Stateless function, global to all Play objects // eslint-disable-next-line no-console var log = location.host.substr(0, 4) !== 'www-' ? function () {} : console.log.bind(console); /* global jwplayer */ var Playset = function () { function Playset() { _classCallCheck(this, Playset); this.id = false; this.selector_play_items = false; this.selector_playlist = false; // only proceed for folks w/ modern browsers.. if (typeof localStorage === 'undefined') return; // Check for, in this order: // "SIMILAR ITEMS" (AKA "Also Found") on items /details/ page (at bottom) // search results page // collection item page // We can add a nice "Play Items" link to any of them. // // NOTE: for "SIMILAR ITEMS", IFF we wanted _more_ than 10, we could add a simple // PHP /services/ new script with something like: // $rel_ids = (new RelatedItemsFetcher())->fetch($id,$collections,75 0,'5s','production'); this.selector_play_items = $('#also-found h5, #search-actions, .welcome-right'); this.selector_playlist = $('#theatre-ia-wrap, #search-actions, .welcome-right' // basically, give up, but in case somehow "show_playlist()" fires, dont fatal: );if (!this.selector_playlist.length) this.selector_playlist = 'body'; if (!this.selector_play_items.length) { this.selector_play_items = false; } else { $(this.selector_play_items).append(''); var htm = React.createElement( 'a', { className: 'stealth', href: '#play-items', onClick: Playset.create_playlist_goto_first_item }, React.createElement('span', { className: 'iconochive-play', 'aria-hidden': 'true' }), React.createElement( 'span', { className: 'sr-only' }, 'play' ), React.createElement( 'span', { className: 'hidden-xs-span' }, ' Play items' ), React.createElement('br', null) ); ReactDOM.render(htm, $('#playplayset').get(0) /* this makes it so people can conveniently pass around/share playlists! eg: https://archive.org/details/georgeblood&and[]=blues&autoplay=1 */ );if (Playset.arg('autoplay') && !Playset.arg('playset')) setTimeout(Playset.create_playlist_goto_first_item, 2500); } if (Playset.arg('playset')) { // proceed when item OR collection /details/ page! this.id = location.href.match(/archive\.org\/details\/([^/&?]+)/)[1]; if (!this.id) return; // setup mobile area if (!$('#playset-xs').length) $('#theatre-ia-wrap').after('