Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
*
* The Apereo Foundation licenses this file to you under the Educational
* Community License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License
* at:
*
* http://opensource.org/licenses/ecl2.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
*/
/* global define, pushHistory */
define(['jquery', 'bootbox.min', 'underscore', 'alertify/alertify', 'js-yaml.min', 'bootstrap-accessibility',
'jquery.liveSearch', 'seedrandom.min', 'jquery.utils',
'dropdowns-enhancement'
],
function($, bootbox, _, alertify, jsyaml) {
// bool
var debug = false;
var askedForLogin = false;
var checkLoggedOut = false;
// URL's and Endpoints
var restEndpoint = '/search/';
var playerEndpoint = '/play/';
var infoMeURL = '/info/me.json';
var configURL = '/ui/config/engage-ui/config.yml';
var springSecurityLoginURL = '/j_spring_security_check';
var springSecurityLogoutURL = '/j_spring_security_logout';
// various variables
var mediaContainer = '
';
var page = 1;
var sort = '';
var totalEntries = -1;
var bufferEntries = 18; // number of entries to load for one page.
var restData = '';
var active = 'episodes';
var tabIndexNumber = 100;
var seriesRgbMax = new Array(220, 220, 220); //color range.
var seriesRgbOffset = new Array(20, 20, 20); //darkest possible color
var sortMap = {};
var sortDescription = '';
// localization placeholder
var title_enterUsernamePassword = 'Login with your Opencast account';
var placeholder_username = 'Username';
var placeholder_password = 'Password';
var placeholder_rememberMe = 'Remember me';
var msg_enterUsernamePassword = 'Please enter your username and password:';
var msg_html_sthWentWrong = '
Something went wrong. Try again!
';
var msg_html_noepisodes = '
No episodes available
';
var msg_html_noseries = '
No series available
';
var msg_html_loading = '
Loading...
';
var msg_html_mediapackageempty = '
No episodes available
';
var msg_html_nodata = '
No data available
';
var msg_loginSuccessful = 'Successfully logged in. Please reload the page if the page does not reload automatically.';
var msg_not_logged_in = 'Not logged in';
var msg_loginFailed = 'Failed to log in.';
var msg_live_in_progress = 'Live (in progress)';
var msg_live_not_in_progress = 'Live (not in progress)';
var springLoggedInStrCheck = 'j_spring_security_check';
var $navbarEpisodes = '#navbarEpisodes';
var $navbarSeries = '#navbarSeries';
var $headerLogo = '#headerLogo';
var $nav_switch_li = '#nav-switch li';
var $oc_search_form = '#oc-search-form';
var $oc_sort_dropdown = '.oc-sort-dropdown';
var $main_container = '#main-container';
var $next = '.next';
var $previous = '.previous';
var $more_content = '#more';
var $no_more_content = '#no-more';
var id_mhlogolink = 'mhlogolink';
var $nav_username = '#nav-username';
var $nav_loginlogoutLink = '#nav-loginlogoutLink';
var $name_loginlogout = '#name-loginlogout';
var $glyph_loginlogout = '#glyph-loginlogout';
var epFromGet = '',
searchQuery = '';
function log(args) {
if (debug && window.console) {
// eslint-disable-next-line no-console
console.log(args);
}
}
function detectLanguage() {
return navigator.language
|| navigator.userLanguage
|| navigator.browserLanguage
|| navigator.systemLanguage
|| 'en-US';
}
function getDefaultLanguage(language) {
var lang = language.substring(0, language.indexOf('-'));
if (!lang || lang.length <= 0) {
lang = language;
}
switch (lang) {
case 'de': return 'de-DE';
case 'da': return 'da-DK';
case 'el': return 'el-GR';
case 'en': return 'en-US';
case 'es': return 'es-ES';
case 'fr': return 'fr-FR';
case 'gl': return 'gl-ES';
case 'he': return 'he-IL';
case 'it': return 'it-IT';
case 'nl': return 'nl-NL';
case 'pl': return 'pl-PL';
case 'sl': return 'sl-SI';
case 'sv': return 'sv-SE';
case 'tr': return 'tr-TR';
case 'zh': return 'zh-CN';
default: return null;
}
}
function loadAndTranslate(callbackFunction, lang) {
log('loadAndTranslate');
if (!lang) lang = detectLanguage();
var selectedLanguage = lang;
if (getDefaultLanguage(lang) !== null) {
selectedLanguage = getDefaultLanguage(lang);
}
var jsonstr = window.location.origin + '/engage/ui/language/' + selectedLanguage + '.json';
log('Detected Language: ' + selectedLanguage);
var template;
// load template
$.ajax({
url: window.location.origin + '/engage/ui/template/desktop.html',
dataType: 'html'
}).fail(function() {
$('body').append('Error loading template.');
}).done(function(tData) {
// set template data
template = _.template(tData);
// load translation
$.ajax({
url: jsonstr,
dataType: 'json'
}).fail(function() {
log('Failed to load language data for ' + selectedLanguage + '. Try to load alternative.');
// load default en-US
loadAndTranslate(callbackFunction, 'en-US');
}).done(function(data) {
log('Append template and set variables.');
setTemplateAndVariables(data, template);
}).then(callbackFunction);
}); // ajax translation
}
function GetURLParameter(sParam) {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
function setTemplateAndVariables(tData, template) {
log('setTemplateAndVariables');
$('body').append(template(tData));
sortMap['DATE_CREATED_DESC'] = tData.recording_date_new;
sortMap['DATE_CREATED'] = tData.recording_date_old;
sortMap['DATE_PUBLISHED_DESC'] = tData.publishing_date_new;
sortMap['DATE_PUBLISHED'] = tData.publishing_date_old;
sortMap['TITLE'] = tData.title_a_z;
sortMap['TITLE_DESC'] = tData.title_z_a;
sortMap['CREATOR'] = tData.author_a_z;
sortMap['CREATOR_DESC'] = tData.author_z_a;
sortMap['CONTRIBUTOR'] = tData.contributor_a_z;
sortMap['CONTRIBUTOR_DESC'] = tData.contributor_z_a;
sortMap['PUBLISHER'] = tData.publisher_a_z;
sortMap['PUBLISHER_DESC'] = tData.publisher_z_a;
sortMap['SERIES_ID'] = tData.series;
sortMap['LANGUAGE'] = tData.language;
sortMap['LICENSE'] = tData.license;
sortMap['SUBJECT'] = tData.subject;
sortMap['DESCRIPTION'] = tData.description;
// set variables
title_enterUsernamePassword = tData.login_title;
placeholder_username = tData.username;
placeholder_password = tData.password;
placeholder_rememberMe = tData.remember_me;
msg_enterUsernamePassword = tData.login_request;
msg_html_sthWentWrong = '