This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// collection of checkboxes obtained by getElementsByName() | |
/** | |
* get array of values for checked boxes in a collection | |
* @param {htmlElementCollection} checkBoxCollection collection of checkbox elements | |
* @return {Array} array of the values of the checked boxes | |
*/ | |
function getCheckedBoxValues(checkBoxCollection) { | |
var checkedValues = [], | |
i, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript part | |
var BCLS = ( function (window, document, rome) { | |
var dateRangeType = document.getElementById('dateRangeType'), | |
fromDate = document.getElementById('fromDate'), | |
toDate = document.getElementById('toDate'), | |
dateTypeValue, | |
fromDateValue, | |
toDateValue, | |
searchString; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- HTML part --> | |
<!-- date picker styles --> | |
<link rel="stylesheet" href="https://learning-services-media.brightcove.com/doc-assets/js/rome/rome.min.css" /> | |
<table class="bcls-table"> | |
<caption>Limit search by dates:</caption> | |
<tbody> | |
<tr> | |
<td>Date type</td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add one array to another | |
* @param {Array} a The array to add another array to | |
* @param {Array} b The array to add to array a | |
* @return {Array} Array a with b appended to it | |
*/ | |
function combineArrays(a, b) { | |
a.push.apply(a, b); | |
return a; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* utility to extract h/m/s from seconds | |
* @param {number} secs - seconds to convert to hh:mm:ss | |
* @returns {object} object with members h (hours), m (minutes), s (seconds) | |
*/ | |
function secondsToTime(secs) { | |
var hours = Math.floor(secs / (60 * 60)), | |
divisor_for_minutes = secs % (60 * 60), | |
minutes = Math.floor(divisor_for_minutes / 60), | |
divisor_for_seconds = divisor_for_minutes % 60, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* gets value of a URL param on current page URL if exists | |
* @param {string} name the param you want the value of | |
* @return {string} result value of param if exists or "" | |
*/ | |
function getURLparam(name) { | |
var regex, | |
results; | |
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* determines whether specified item is in an array | |
* | |
* @param {array} array to check | |
* @param {string} item to check for | |
* @return {boolean} true if item is in the array, else false | |
*/ | |
function arrayContains(arr, item) { | |
var i, | |
iMax = arr.length; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* remove spaces from a string | |
* @param {String} str string to process | |
* @return {String} trimmed string | |
*/ | |
function removeSpaces(str) { | |
str= str.replace(/\s/g, ''); | |
return str; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* dedupe a simple array of strings or numbers | |
* @param {array} arr the array to be deduped | |
* @return {array} out the deduped array | |
*/ | |
function dedupe(arr) { | |
var i, | |
len = arr.length, | |
out = [], | |
obj = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Note: you will likely need to change the operations and the image --> | |
<section class="bcls-section"> | |
<h2 id="getCredentials" class="bcls-expander-head">Get credentials</h2> | |
<div class="bcls-expander-content"> | |
<p>To use the CMS API you will need proper credentials.</p> | |
<p>The easiest way to get credentials in most cases is through the Studio Admin API Authentication section (requires admin permissions on your account). See <a href="/node/14056">Managing API Authentication Credentials</a> for details. In this case, the permissions you need are for <strong>sharing relationships</strong> - you need both read and write permissions:</p> | |
<figure class="bcls-figure"> | |
<img class="bcls-image" src="" alt="Sharing Relationship Permissions"> | |
<figcaption class="bcls-caption--image">Sharing Relationship Permissions</figcaption> | |
</figure> |
NewerOlder