clean up, UI rework, getSelectedClips implemented

This commit is contained in:
antirotor 2019-01-19 00:52:35 +01:00
parent f931405a22
commit 38da108b7f
No known key found for this signature in database
GPG key ID: 8A29C663C672C2B7
23 changed files with 484 additions and 16921 deletions

View file

@ -1,275 +1,304 @@
/* global app, qe, ExternalObject, CSXSEvent */
var projectItems = [];
var sequences = [];
function importClips(obj) {
app.project.importFiles(obj.paths);
return JSON.stringify(obj);
function importClips (obj) {
app.project.importFiles(obj.paths);
return JSON.stringify(obj);
}
function getEnv() {
function getEnv () {
app.enableQE();
var obj = {
os: qe.platform,
name: app.project.name,
path: app.project.path
};
return JSON.stringify(obj);
}
function getSequences () {
var project = app.project;
// var sequences = [];
for (var i = 0; i < project.sequences.numSequences; i++) {
var seq = project.sequences[i];
seq.clipNames = [];
sequences[i] = seq;
log('sequences[i] id: ' + project.sequences[i].sequenceID);
}
var obj = {
sequences: sequences
};
return JSON.stringify(obj);
}
function getSequenceItems (seqs) {
app.enableQE();
qe.project.init();
sequences = seqs;
// log('getSequenceItems sequences obj from app: ' + sequences);
var rootFolder = app.project.rootItem;
var binCounter = -1;
var rootSeqCounter = -1; // count sequences in root folder
// walk through root folder of project to differentiate between bins, sequences and clips
for (var i = 0; i < rootFolder.children.numItems; i++) {
// log('\nroot item at ' + i + " is " + rootFolder.children[i].name + " of type " + rootFolder.children[i].type);
var item = rootFolder.children[i];
// log('item has video tracks? ' + item.videoTracks);
if (item.type === 2) { // bin
binCounter++;
walkBins(item, 'root', binCounter);
} else if (item.type === 1 && !item.getMediaPath()) { // sequence OR other type of object
// log('\nObject of type 1 in root: ' + typeof item + ' ' + item.name);
if (objectIsSequence(item)) { // objects of type can also be other objects such as titles, so check if it really is a sequence
// log('\nSequence in root: ' + item.name );
rootSeqCounter++;
var seq = qe.project.getSequenceAt(rootSeqCounter);
// log('\nSequence in root, guid: ' + seq );
for (var property in seq) {
if (seq.hasOwnProperty(property)) {
// log('\nSequence in root: ' + seq );
// log('qe sequence prop: ' + property );
}
}
getClipNames(seq, sequences);
}
}
}
function objectIsSequence () {
var isSequence = false;
for (var s = 0; s < app.project.sequences.numSequences; s++) {
if (item.name === app.project.sequences[s].name) {
isSequence = true;
}
}
return isSequence;
}
// walk through bins recursively
function walkBins (item, source, rootBinCounter) {
app.enableQE();
var obj = {
os: qe.platform,
name: app.project.name,
path: app.project.path
// log('\nget clips for bin ' + item.name );
var bin;
if (source === 'root') { // bin in root folder
bin = qe.project.getBinAt(rootBinCounter);
} else { // bin in other bin
bin = item;
for (var i = 0; i < bin.numBins; i++) { // if bin contains bin(s) walk through them
walkBins(bin.getBinAt(i));
}
// log('Bin ' + bin.name + ' has ' + bin.numSequences + ' sequences ' );
// var seqCounter = -1;
for (var j = 0; j < bin.numSequences; j++) {
// if(objectIsSequence(item)) {//objects of type can also be other objects such as titles, so check if it really is a sequence?
// not needed because getSequenceAt apparently only looks at sequences already?
var seq = bin.getSequenceAt(j);
// log('\nSequence in bin, guid: ' + seq.guid );
getClipNames(seq, sequences);
}
}
return JSON.stringify(obj);
}
// walk through sequences and video & audiotracks to find clip names in sequences
function getClipNames (seq, sequences) {
for (var k = 0; k < sequences.length; k++) {
// log('getClipNames seq.guid ' + seq.guid );
// log(' getClipNames sequences[k].id ' + sequences[k].sequenceID );
if (seq.guid === sequences[k].sequenceID) {
// log('Sequence ' + seq.name + ' has ' + app.project.sequences[k].videoTracks.numTracks +' video tracks' );
// log('Sequence ' + seq.name + ' has ' + app.project.sequences[k].audioTracks.numTracks +' audio tracks' );
// VIDEO CLIPS IN SEQUENCES
for (var l = 0; l < sequences[k].videoTracks.numTracks; l++) {
var videoTrack = seq.getVideoTrackAt(l);
// log(seq.name + ' has video track '+ videoTrack.name + ' at index ' + l);
var clipCounter = 0;
var numOfClips = app.project.sequences[k].videoTracks[l].clips.numTracks;
// log('\n' + bin.name + ' ' + seq.name + ' ' + videoTrack.name + ' has ' + numOfClips + ' clips');
for (var m = 0; m < numOfClips; m++) {
// var clip = app.project.sequences[k].videoTracks[l].clips[m];
// log('clips in video tracks: ' + m + ' - ' + clip); //TrackItem, doesn't have name property
// if a clip was deleted and another one added, the index of the new one is one or more higher
while (clipCounter < numOfClips) { // undefined because of old clips
if (videoTrack.getItemAt(m).name) {
clipCounter++;
// log('getClipNames ' + seq.name + ' ' + videoTrack.name + ' has ' + videoTrack.getItemAt(m).name); //Object
for (var s = 0; s < sequences.length; s++) {
if (seq.guid === sequences[s].sequenceID) {
sequences[s].clipNames.push(videoTrack.getItemAt(m).name);
}
}
}
m++;
}
}
}
// log('jsx after video loop clipsInSequences:' + clipsInSequences);
// AUDIO CLIPS IN SEQUENCES
for (var l = 0; l < sequences[k].audioTracks.numTracks; l++) {
var audioTrack = seq.getAudioTrackAt(l);
// log(bin.name + ' ' + seq.name + ' has audio track '+ audioTrack.name + ' at index ' + l);
// log('\n' + bin.name + ' ' + seq.name + ' ' + audioTrack.name + ' has ' + app.project.sequences[k].audioTracks[l].clips.numTracks + ' clips');
var clipCounter = 0;
var numOfClips = app.project.sequences[k].audioTracks[l].clips.numTracks;
for (var m = 0; m < numOfClips; m++) {
var clip = app.project.sequences[k].audioTracks[l].clips[m];
// log('clips in audio tracks: ' + m + ' - ' + clip);
// if a clip was deleted and another one added, the index of the new one is one or more higher
while (clipCounter < numOfClips) { // undefined because of old clips
if (audioTrack.getItemAt(m).name) {
clipCounter++;
// log(seq.name + ' ' + audioTrack.name + ' has ' + audioTrack.getItemAt(m).name);
for (var s = 0; s < sequences.length; s++) {
if (seq.guid === sequences[s].sequenceID) {
sequences[s].clipNames.push(audioTrack.getItemAt(m).name);
}
}
}
m++;
}
}
}
} // end if
} // end for
} // end getClipNames
log('sequences returned:' + sequences);
// return result to ReplaceService.js
var obj = {
data: sequences
};
// log('jsx getClipNames obj:' + obj);
return JSON.stringify(obj);
}
function getSequences() {
var project = app.project;
// var sequences = [];
for (var i = 0; i < project.sequences.numSequences; i++) {
var seq = project.sequences[i];
seq.clipNames = [];
sequences[i] = seq;
log('sequences[i] id: ' + project.sequences[i].sequenceID);
}
// getSequenceItems();
var obj = {
sequences: sequences
}
return JSON.stringify(obj);
}
function getProjectItems () {
projectItems = [];
app.enableQE();
qe.project.init();
function getSequenceItems(seqs) {
var rootFolder = app.project.rootItem;
// walk through root folder of project to differentiate between bins, sequences and clips
for (var i = 0; i < rootFolder.children.numItems; i++) {
// log('\nroot item at ' + i + " is of type " + rootFolder.children[i].type);
var item = rootFolder.children[i];
if (item.type === 2) { // bin
// log('\n' );
walkBins(item);
} else if (item.type === 1 && item.getMediaPath()) { // clip in root
// log('Root folder has ' + item + ' ' + item.name);
projectItems.push(item);
}
}
// walk through bins recursively
function walkBins (bin) {
app.enableQE();
qe.project.init();
sequences = seqs;
// log('getSequenceItems sequences obj from app: ' + sequences);
var rootFolder = app.project.rootItem;
var binCounter = -1;
var rootSeqCounter = -1; //count sequences in root folder
//walk through root folder of project to differentiate between bins, sequences and clips
for (var i = 0; i < rootFolder.children.numItems; i++) {
// log('\nroot item at ' + i + " is " + rootFolder.children[i].name + " of type " + rootFolder.children[i].type);
var item = rootFolder.children[i];
// log('item has video tracks? ' + item.videoTracks);
if (item.type == 2) { //bin
binCounter++;
walkBins(item, 'root', binCounter);
} else if (item.type == 1 && !item.getMediaPath()) //sequence OR other type of object
{
// log('\nObject of type 1 in root: ' + typeof item + ' ' + item.name);
if (objectIsSequence(item)) { //objects of type can also be other objects such as titles, so check if it really is a sequence
// log('\nSequence in root: ' + item.name );
rootSeqCounter++;
var seq = qe.project.getSequenceAt(rootSeqCounter);
// log('\nSequence in root, guid: ' + seq );
for (var property in seq) {
if (seq.hasOwnProperty(property)) {
// log('\nSequence in root: ' + seq );
//log('qe sequence prop: ' + property );
}
}
getClipNames(seq, sequences);
}
// $.writeln('bin.name + ' has ' + bin.children.numItems);
for (var i = 0; i < bin.children.numItems; i++) {
var object = bin.children[i];
// log(bin.name + ' has ' + object + ' ' + object.name + ' of type ' + object.type + ' and has mediapath ' + object.getMediaPath() );
if (object.type === 2) { // bin
// log(object.name + ' has ' + object.children.numItems );
for (var j = 0; j < object.children.numItems; j++) {
var obj = object.children[j];
if (obj.type === 1 && obj.getMediaPath()) { // clip in sub bin
// log(object.name + ' has ' + obj + ' ' + obj.name );
projectItems.push(obj);
} else if (obj.type === 2) { // bin
walkBins(obj);
}
}
} else if (object.type === 1 && object.getMediaPath()) { // clip in bin in root
// log(bin.name + ' has ' + object + ' ' + object.name );
projectItems.push(object);
}
}
function objectIsSequence() {
var isSequence = false;
for (var s = 0; s < app.project.sequences.numSequences; s++)
if (item.name == app.project.sequences[s].name)
isSequence = true;
return isSequence
}
// walk through bins recursively
function walkBins(item, source, rootBinCounter) {
app.enableQE();
// log('\nget clips for bin ' + item.name );
var bin;
if (source == 'root') //bin in root folder
bin = qe.project.getBinAt(rootBinCounter);
else // bin in other bin
bin = item;
for (var i = 0; i < bin.numBins; i++) //if bin contains bin(s) walk through them
walkBins(bin.getBinAt(i));
// log('Bin ' + bin.name + ' has ' + bin.numSequences + ' sequences ' );
var seqCounter = -1;
for (var j = 0; j < bin.numSequences; j++) {
//if(objectIsSequence(item)) {//objects of type can also be other objects such as titles, so check if it really is a sequence?
//not needed because getSequenceAt apparently only looks at sequences already?
var seq = bin.getSequenceAt(j);
// log('\nSequence in bin, guid: ' + seq.guid );
getClipNames(seq, sequences);
//}
}
}
//walk through sequences and video & audiotracks to find clip names in sequences
function getClipNames(seq, sequences) {
for (var k = 0; k < sequences.length; k++) {
// log('getClipNames seq.guid ' + seq.guid );
//log(' getClipNames sequences[k].id ' + sequences[k].sequenceID );
if (seq.guid == sequences[k].sequenceID) {
// log('Sequence ' + seq.name + ' has ' + app.project.sequences[k].videoTracks.numTracks +' video tracks' );
// log('Sequence ' + seq.name + ' has ' + app.project.sequences[k].audioTracks.numTracks +' audio tracks' );
//VIDEO CLIPS IN SEQUENCES
for (var l = 0; l < sequences[k].videoTracks.numTracks; l++) {
var videoTrack = seq.getVideoTrackAt(l);
// log(seq.name + ' has video track '+ videoTrack.name + ' at index ' + l);
var clipCounter = 0;
var numOfClips = app.project.sequences[k].videoTracks[l].clips.numTracks;
// log('\n' + bin.name + ' ' + seq.name + ' ' + videoTrack.name + ' has ' + numOfClips + ' clips');
for (var m = 0; m < numOfClips; m++) {
var clip = app.project.sequences[k].videoTracks[l].clips[m];
// log('clips in video tracks: ' + m + ' - ' + clip); //TrackItem, doesn't have name property
//if a clip was deleted and another one added, the index of the new one is one or more higher
while (clipCounter < numOfClips) //undefined because of old clips
{
if (videoTrack.getItemAt(m).name) {
clipCounter++;
// log('getClipNames ' + seq.name + ' ' + videoTrack.name + ' has ' + videoTrack.getItemAt(m).name); //Object
for (var s = 0; s < sequences.length; s++)
if (seq.guid == sequences[s].sequenceID)
sequences[s].clipNames.push(videoTrack.getItemAt(m).name);
}
m++;
}
}
}
// log('jsx after video loop clipsInSequences:' + clipsInSequences);
//AUDIO CLIPS IN SEQUENCES
for (var l = 0; l < sequences[k].audioTracks.numTracks; l++) {
var audioTrack = seq.getAudioTrackAt(l);
//log(bin.name + ' ' + seq.name + ' has audio track '+ audioTrack.name + ' at index ' + l);
//log('\n' + bin.name + ' ' + seq.name + ' ' + audioTrack.name + ' has ' + app.project.sequences[k].audioTracks[l].clips.numTracks + ' clips');
var clipCounter = 0;
var numOfClips = app.project.sequences[k].audioTracks[l].clips.numTracks;
for (var m = 0; m < numOfClips; m++) {
var clip = app.project.sequences[k].audioTracks[l].clips[m];
// log('clips in audio tracks: ' + m + ' - ' + clip);
//if a clip was deleted and another one added, the index of the new one is one or more higher
while (clipCounter < numOfClips) //undefined because of old clips
{
if (audioTrack.getItemAt(m).name) {
clipCounter++;
// log(seq.name + ' ' + audioTrack.name + ' has ' + audioTrack.getItemAt(m).name);
for (var s = 0; s < sequences.length; s++)
if (seq.guid == sequences[s].sequenceID)
sequences[s].clipNames.push(audioTrack.getItemAt(m).name);
}
m++;
}
}
}
} //end if
} //end for
} //end getClipNames
log('sequences returned:' + sequences);
//return result to ReplaceService.js
var obj = {
data: sequences
};
// log('jsx getClipNames obj:' + obj);
return JSON.stringify(obj);
}
log('\nprojectItems:' + projectItems.length + ' ' + projectItems);
return projectItems;
}
//getSequenceItems();
function replaceClips (obj) {
log('num of projectItems:' + projectItems.length);
var hiresVOs = obj.hiresOnFS;
for (var i = 0; i < hiresVOs.length; i++) {
log('hires vo name: ' + hiresVOs[i].name);
log('hires vo id: ' + hiresVOs[i].id);
log('hires vo path: ' + hiresVOs[i].path);
log('hires vo replace: ' + hiresVOs[i].replace);
function getProjectItems() {
projectItems = [];
app.enableQE();
qe.project.init();
var rootFolder = app.project.rootItem;
//walk through root folder of project to differentiate between bins, sequences and clips
for (var i = 0; i < rootFolder.children.numItems; i++) {
// log('\nroot item at ' + i + " is of type " + rootFolder.children[i].type);
var item = rootFolder.children[i];
if (item.type == 2) { //bin
// log('\n' );
walkBins(item);
} else if (item.type == 1 && item.getMediaPath()) //clip in root
{
// log('Root folder has ' + item + ' ' + item.name);
projectItems.push(item);
}
for (var j = 0; j < projectItems.length; j++) {
// log('projectItem id: ' + projectItems[j].name.split(' ')[0] + ' ' + hiresVOs[i].id + ' can change path ' + projectItems[j].canChangeMediaPath() );
if (projectItems[j].name.split(' ')[0] === hiresVOs[i].id && hiresVOs[i].replace && projectItems[j].canChangeMediaPath()) {
log('replace: ' + projectItems[j].name + ' with ' + hiresVOs[i].name);
projectItems[j].name = hiresVOs[i].name;
projectItems[j].changeMediaPath(hiresVOs[i].path);
}
}
// walk through bins recursively
function walkBins(bin) {
app.enableQE();
// $.writeln('bin.name + ' has ' + bin.children.numItems);
for (var i = 0; i < bin.children.numItems; i++) {
var object = bin.children[i];
// log(bin.name + ' has ' + object + ' ' + object.name + ' of type ' + object.type + ' and has mediapath ' + object.getMediaPath() );
if (object.type == 2) { //bin
// log(object.name + ' has ' + object.children.numItems );
for (var j = 0; j < object.children.numItems; j++) {
var obj = object.children[j];
if (obj.type == 1 && obj.getMediaPath()) { //clip in sub bin
//log(object.name + ' has ' + obj + ' ' + obj.name );
projectItems.push(obj);
} else if (obj.type == 2) { //bin
walkBins(obj);
}
}
} else if (object.type == 1 && object.getMediaPath()) //clip in bin in root
{
// log(bin.name + ' has ' + object + ' ' + object.name );
projectItems.push(object);
}
}
}
log('\nprojectItems:' + projectItems.length + ' ' + projectItems);
return projectItems;
}
}
function replaceClips(obj) {
function getSelectedItems () {
var seq = app.project.activeSequence;
var selected = [];
log('num of projectItems:' + projectItems.length);
var hiresVOs = obj.hiresOnFS;
for (var i = 0; i < hiresVOs.length; i++) {
log('hires vo name: ' + hiresVOs[i].name);
log('hires vo id: ' + hiresVOs[i].id);
log('hires vo path: ' + hiresVOs[i].path);
log('hires vo replace: ' + hiresVOs[i].replace);
for (var j = 0; j < projectItems.length; j++) {
// log('projectItem id: ' + projectItems[j].name.split(' ')[0] + ' ' + hiresVOs[i].id + ' can change path ' + projectItems[j].canChangeMediaPath() );
if (projectItems[j].name.split(' ')[0] == hiresVOs[i].id && hiresVOs[i].replace && projectItems[j].canChangeMediaPath()) {
log('replace: ' + projectItems[j].name + ' with ' + hiresVOs[i].name);
projectItems[j].name = hiresVOs[i].name;
projectItems[j].changeMediaPath(hiresVOs[i].path);
}
}
// VIDEO CLIPS IN SEQUENCES
for (var l = 0; l < seq.videoTracks.numTracks; l++) {
var numOfClips = seq.videoTracks[l].clips.numTracks;
// $.writeln('\n' + seq.name + ' ' + seq.videoTracks[l].name + ' has ' + numOfClips + ' clips');
for (var m = 0; m < numOfClips; m++) {
var clip = seq.videoTracks[l].clips[m];
if (clip.isSelected()) {
var inter = clip.projectItem.getFootageInterpretation();
var clipData = {
'name': clip.name,
'in': clip.inPoint.seconds,
'out': clip.outPoint.seconds,
'start': clip.start.seconds,
'duration': clip.duration.seconds,
'path': clip.projectItem.getMediaPath(),
'fps': inter.frameRate,
'par': inter.pixelAspectRatio
};
selected.push(clipData);
// $.writeln('\n' + clip.name + ' selected');
}
}
}
return JSON.stringify(selected);
}
function log(info) {
try {
var xLib = new ExternalObject("lib:\PlugPlugExternalObject");
} catch (e) {
alert(e);
}
function log (info) {
try {
var xLib = new ExternalObject('lib:\\PlugPlugExternalObject');
} catch (e) {
alert(e);
}
if (xLib) {
var eventObj = new CSXSEvent();
eventObj.type = "LogEvent";
eventObj.data = info;
eventObj.dispatch();
}
if (xLib) {
var eventObj = new CSXSEvent();
eventObj.type = "LogEvent";
eventObj.data = info;
eventObj.dispatch();
}
}
function message(msg) {

View file

@ -1,360 +0,0 @@
/**
* Angular RangeSlider SCSS
*
* Version: 0.0.14
*
* Author: Daniel Crisp, danielcrisp.com
*
* The rangeSlider has been styled to match the default styling
* of form elements styled using Twitter's Bootstrap
*
* Originally forked from https://github.com/leongersen/noUiSlider
*
This code is released under the MIT Licence - http://opensource.org/licenses/MIT
Copyright (c) 2013 Daniel Crisp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*------------------------------------*\
COMPASS IMPORTS
\*------------------------------------*/
/*------------------------------------*\
SETTINGS
\*------------------------------------*/
/*------------------------------------*\
THE CSS
\*------------------------------------*/
/* line 25, scss/_rangeSlider.scss */
.ngrs-range-slider {
position: relative;
margin: 10px 0 30px;
padding-left: 14px;
padding-right: 14px;
/* border: 1px solid #ccc;*/
/* background: #fff;*/
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-transition: border 0.2s linear, box-shadow 0.2s linear;
-o-transition: border 0.2s linear, box-shadow 0.2s linear;
-webkit-transition: border 0.2s linear, box-shadow 0.2s linear;
transition: border 0.2s linear, box-shadow 0.2s linear;
-webkit-tap-highlight-color: transparent;
/*------------------------------------*\
RUNNER
\*------------------------------------*/
/*------------------------------------*\
JOIN (connects the two handles)
\*------------------------------------*/
/*------------------------------------*\
HANDLE
\*------------------------------------*/
/*------------------------------------*\
HANDLE SPECIFICS
\*------------------------------------*/
/*------------------------------------*\
VALUE LABELS
\*------------------------------------*/
/*------------------------------------*\
ATTACHED VALUE RUNNER
\*------------------------------------*/
/*------------------------------------*\
VERTICAL SLIDER
\*------------------------------------*/
/*------------------------------------*\
FOCUS STATE
\*------------------------------------*/
/*------------------------------------*\
DISABLED STATE
\*------------------------------------*/
}
/* line 28, scss/_rangeSlider.scss */
.ngrs-range-slider, .ngrs-range-slider * {
display: block;
cursor: default;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-moz-user-select: -moz-none;
-ms-user-select: none;
-webkit-user-select: none;
user-select: none;
}
/* line 53, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-runner {
position: relative;
margin: 0 9px;
height: 18px;
}
/* line 63, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-join {
position: absolute;
z-index: 1;
top: 55%;
left: 0;
right: 100%;
height: 4px; /* CHANGED height, top and color line*/
margin: -4px 0 0 0;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
background-color: #1d84fa;
/* background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzViYzBkZSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzJmOTZiNCIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');*/
background-size: 100%;
/*
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
background-image: -moz-linear-gradient(#5bc0de, #2f96b4);
background-image: -webkit-linear-gradient(#5bc0de, #2f96b4);
background-image: linear-gradient(#5bc0de, #2f96b4);
*/
}
/* line 81, scss/_rangeSlider.scss CHANGED HANDLES */
.ngrs-range-slider .ngrs-handle {
position: absolute;
z-index: 2;
/* height: 100%;*/
width: 16px;
height: 16px;
/* margin: 0 0 0 -9px;*/
/* background: red;*/
background: url('../../images/slider-handle.png');
background-repeat: no-repeat;
/* border: 1px solid #ccc;*/
/* border-radius: 50%;*/
/*------------------------------------*\
HANDLE ICON
\*------------------------------------*/
}
/* line 95, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-handle i {
display: block;
width: 100%;
height: 100%;
background: no-repeat -9999px -9999px;
cursor: pointer;
}
/* line 104, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-handle.ngrs-over i {
background-position: 50% 50%;
}
/* line 109, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-handle.ngrs-down {
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}
/* line 120, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-handle-min i {
/* background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFNJREFUeNpiYMAEXEDsA+OwoEnKALETEHOgK2AEYhMgNkQ3DqSAB6pLAot1DExIJmAFzED8C4hvQdnIppyFKYCBp0D8CohloVafxWUqN7I3AQIMAKw6B24pOi8lAAAAAElFTkSuQmCC");*/
}
/* line 127, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-handle-max i {
/* background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFdJREFUeNpiYEAAHyDmYkADzEhsByBWA+K3QPwJmwJjIGYBYlUgZgLi59gUwIAkEEsD8VMmBtyAkQFqJDZwAYjPAPE/dAU/gHg/ED/GpgvkTW50QYAAAwADfwrM5sqplgAAAABJRU5ErkJggg==");*/
}
/* line 137, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-value {
position: absolute;
top: 100%;
left: 0;
padding: 5px 0 0 0;
font-size: 12px;
color: #fff;
}
/* line 145, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-value.ngrs-value-max {
left: auto;
right: 0;
text-align: right;
}
/* line 152, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-handle-min-down .ngrs-value-min, .ngrs-range-slider.ngrs-handle-max-down .ngrs-value-max {
color: #fff;
}
/* line 160, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-attached-handles {
margin: 0 9px;
position: relative;
/*------------------------------------*\
ATTACHED VALUE RUNNER LABELS
\*------------------------------------*/
}
/* line 167, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-attached-handles .ngrs-value {
text-align: left;
}
/* line 172, scss/_rangeSlider.scss */
.ngrs-range-slider .ngrs-attached-handles .ngrs-value > div {
margin: 0 0 0 -50%;
}
/* line 181, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical {
width: 28px;
margin: 10px auto;
/*------------------------------------*\
RUNNER
\*------------------------------------*/
/*------------------------------------*\
ATTACHED VALUE RUNNER
\*------------------------------------*/
/*------------------------------------*\
JOIN
\*------------------------------------*/
/*------------------------------------*\
HANDLE
\*------------------------------------*/
/*------------------------------------*\
HANDLE SPECIFICS
\*------------------------------------*/
/*------------------------------------*\
VALUE LABELS
\*------------------------------------*/
/*------------------------------------*\
VERTICAL LEFT SLIDER
\*------------------------------------*/
/*------------------------------------*\
VERTICAL RIGHT SLIDER
\*------------------------------------*/
}
/* line 189, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-runner {
margin: 9px 0;
height: 300px;
width: 18px;
}
/* line 199, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-value-runner.ngrs-attached-handles {
position: absolute;
top: 0;
left: 100%;
bottom: 0;
margin: 9px 0;
}
/* line 212, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-join {
width: 8px;
height: auto;
top: 0;
bottom: 100%;
left: 50%;
right: auto;
margin: 0 0 0 -4px;
}
/* line 226, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-handle {
width: 100%;
height: 18px;
margin: -9px 0 0 0;
}
/* line 237, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-handle-min i {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFFJREFUeNpiYEAFPFAMB0xIbEYgdoJiRpggM5ICUyBWhZoA0vgMWYEsENsg6ZQE4ldA/AmkkguIHZGNhQKQGBfIBHcgFmTABCxALMJAMQAIMAAcNgVQJ7t7JQAAAABJRU5ErkJggg==");
}
/* line 244, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-handle-max i {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeNpiYKAUMAKxDxBL4ZB/xgQk9gHxDyySILF9zEDiNxC/A2JVNAW7gfgtM5TzCYhZgFgCyr8IxNdADGZk+4BYGoi/APEBIP6PzVE8UAwHAAEGAArIDvzRFIA6AAAAAElFTkSuQmCC");
}
/* line 254, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-value {
top: 0;
left: 100%;
padding: 0 0 0 5px;
}
/* line 259, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-value.ngrs-value-max {
top: auto;
bottom: 0;
right: auto;
text-align: left;
}
/* line 269, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical .ngrs-attached-handles .ngrs-value > div {
margin: -50% 0 0 0;
}
/* line 279, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical.ngrs-left {
margin: 10px 0;
}
/* line 287, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical.ngrs-right {
margin: 10px 0 10px auto;
/*------------------------------------*\
VALUE LABELS
\*------------------------------------*/
}
/* line 294, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical.ngrs-right .ngrs-value {
left: auto;
right: 100%;
padding: 0 5px 0 0;
text-align: right;
}
/* line 300, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical.ngrs-right .ngrs-value.ngrs-value-max {
text-align: right;
}
/* line 306, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-vertical.ngrs-right .ngrs-value-runner.ngrs-attached-handles {
left: 0;
}
/* line 318, scss/_rangeSlider.scss */
/*
.ngrs-range-slider.ngrs-focus {
border-color: rgba(82, 168, 236, 0.8);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
}
*/
/* line 329, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-disabled, .ngrs-range-slider.ngrs-disabled.ngrs-focus {
border-color: #ddd;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
/* line 335, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-disabled .ngrs-handle {
background: #fff;
border-color: #ddd;
}
/* line 339, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-disabled .ngrs-handle i {
background: none !important;
cursor: default;
}
/* line 345, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-disabled .ngrs-join {
background: #ddd;
}
/* line 349, scss/_rangeSlider.scss */
.ngrs-range-slider.ngrs-disabled .ngrs-value {
color: #ddd;
}
/*------------------------------------*\
TOUCH STATE
\*------------------------------------*/
/* line 361, scss/_rangeSlider.scss */
body.ngrs-touching {
-ms-touch-action: none;
}

View file

@ -0,0 +1,3 @@
body{background-color:#323238;color:#eeeeee}#output{background:#121212;color:#eeeeee;padding:2em;font-family:monospace;font-weight:bold;min-height:8em}.dark>.list-group-item{background:#454747}
/*# sourceMappingURL=avalon.min.css.map */

View file

@ -0,0 +1,9 @@
{
"version": 3,
"file": "avalon.min.css",
"sources": [
"avalon.scss"
],
"names": [],
"mappings": "AAAA,AAAA,IAAI,AAAC,CACH,gBAAgB,CAAE,OAAO,CACzB,KAAK,CAAE,OAAO,CACf,AAED,AAAA,OAAO,AAAC,CACN,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,OAAO,CACd,OAAO,CAAE,GAAG,CACZ,WAAW,CAAE,SAAS,CACtB,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,GAAG,CAChB,AAED,AAAA,KAAK,CAAG,gBAAgB,AAAC,CACvB,UAAU,CAAE,OAAO,CACpB"
}

View file

@ -0,0 +1,17 @@
body {
background-color: #323238;
color: #eeeeee;
}
#output {
background: #121212;
color: #eeeeee;
padding: 2em;
font-family: monospace;
font-weight: bold;
min-height: 8em;
}
.dark > .list-group-item {
background: #454747;
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,14 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Pype extention</title>
<!-- Load the pico Javascript client, always automatically available at /pico.js -->
<script src="/pico.js"></script>
<!-- Or load our module proxy -->
<script src="/api.js"></script>
<link href="./css/bootstrap.min.css" type="text/css" rel="stylesheet">
<link href="./css/avalon.min.css" type="text/css" rel="stylesheet">
<script>
if (typeof module === 'object') {
window.module = module;
@ -16,142 +21,112 @@
}
</script>
<script data-require="angular.js@1.4.x" src="./js/vendor/angular-1-7-2.min.js"></script>
<!-- <script src="./js/vendor/offlineManager.js"></script> -->
<script src="./js/vendor/offline.min.js"></script>
<script src="./js/vendor/sleep.js"></script>
<script src="./js/vendor/underscore-min.js"></script>
<script src="./js/vendor/md5.min.js"></script>
<script src="./js/vendor/angular.rangeSlider.js"></script>
<script src="./js/vendor/jquery-3.3.1.min.js"></script>
<script src="./js/vendor/jquery-ui.min.js"></script>
<script src="./js/vendor/velocity.min.js"></script>
<script src="./js/vendor/CSInterface-8.js"></script>
<script src="./js/vendor/ui-bootstrap-tpls-0.11.0.min.js"></script>
<script src="./js/build.js"></script>
<script src="./js/vendor/popper.min.js"></script>
<script src="./js/vendor/bootstrap.min.js"></script>
<script>
if (window.module) module = window.module;
</script>
<link rel="stylesheet" href="./css/angular.rangeSlider.css">
<style type="text/css">
html,
body {
height: 100%;
margin: 0px;
padding: 0px;
}
div {
padding: 5px;
}
#container {
height: 100%;
}
#header {
height: 5%;
}
#main {
height: 70%;
}
#output {
background-color: #333;
color: #aaa;
min-height: 15%;
overflow-y: scroll;
padding: 20px;
position: fixed;
bottom: 0px;
width: 100%;
}
.error {
color: #f00 !important;
}
#examples li {
padding: 10px;
margin: 10px;
background-color: silver;
}
code {
border-radius: 0;
*/ margin: 5px;
white-space: pre !important;
}
#source {
height: 100%;
}
#examples {
height: 100%;
}
#spacer {
height: 20%;
}
.highlight {
background-color: yellow;
}
</style>
</head>
<body onresize="resizePanel()">
<a href="javascript:history.go(0)">Refresh panel</a>
<div id="container">
<div class="row row-eq-height" id="main">
<div class="col-md-6" id="examples">
<ol>
<li id="context">
<h4>Set context here</h4>
<pre><code class="js"></code></pre>
Project<input type="text" name="project" value="jakub_projectx" />Asset<input type="text" name="asset" value="shot01" />task<input type="text" name="task" value="compositing" />app<input type="text" name="app" value="premiera" />
<button class="btn btn-default btn-sm" type="button" onclick="context()">Set context</button>
</li>
<li id="deregister">
<h4>deregister_plugin_path</h4>
<pre><code class="js"></code></pre>
<button class="btn btn-default btn-sm" type="button" onclick="deregister()">Deregister</button>
</li>
<li id="register">
<h4>register_plugin_path</h4>
<pre><code class="js"></code></pre>
Path: <input type="text" name="path" value="C:/Users/hubertCODE/pype-setup/repos/pype-config/pype/plugins/premiere/publish" />
<button class="btn btn-default btn-sm" type="button" onclick="register()">Register path</button>
</li>
<li id="publish">
<h4>Publish</h4>
<pre><code class="js"></code></pre>
Json path: <input type="text" name="path" value="C:/Users/hubert/CODE/pype-setup/repos/pype-config/pype/premiere/example_publish_reqst.json" />
Gui<input type="checkbox" name="gui" value="True" checked>
<button class="btn btn-default btn-sm" type="button" onclick="publish()">Publish</button>
</li>
<body>
</ol>
<div id="spacer">
</div>
</div>
<div class="col-md-6" id="source">
<div id="section"><a href="javascript:history.go(0)">Refresh panel</a>
<ul class="list-group list-group-flush dark">
<li class="list-group-item" id="context">
<h5>Set context here</h5>
<pre><code class="js"></code></pre>
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Project</span>
</div>
<input type="text" class="form-control" name="project" placeholder="Project" aria-label="Project" aria-describedby="basic-addon1" value="jakub_projectx">
</div>
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon2">Asset</span>
</div>
<input type="text" class="form-control" name="asset" placeholder="Asset" aria-label="Asset" aria-describedby="basic-addon2" value="shot01">
</div>
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon3">Task</span>
</div>
<input type="text" class="form-control" name="task" placeholder="Task" aria-label="Task" aria-describedby="basic-addon3" value="compositing">
</div>
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon4">App</span>
</div>
<input type="text" class="form-control" name="app" placeholder="App" aria-label="App" aria-describedby="basic-addon4" value="premiere">
</div>
<button id="btn-set-context" type="button" class="btn btn-dark btn-sm btn-block">Set context</button>
</li>
<li class="list-group-item" id="deregister">
<h5>deregister_plugin_path</h5>
<pre><code class="js"></code></pre>
<button id="btn-deregister" type="button" class="btn btn-dark btn-sm btn-block">Deregister</button>
</li>
<li class="list-group-item" id="register">
<h5>register_plugin_path</h5>
<pre><code class="js"></code></pre>
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon5">Path</span>
</div>
<input type="text" class="form-control" name="path" placeholder="Path" aria-label="Path" aria-describedby="basic-addon5" value="C:/Users/hubertCODE/pype-setup/repos/pype-config/pype/plugins/premiere/publish">
</div>
<button id="btn-register" type="button" class="btn btn-dark btn-sm btn-block">Register path</button>
</li>
<li class="list-group-item" id="publish">
<h5>Publish</h5>
<pre><code class="js"></code></pre>
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon6">Path</span>
</div>
<input type="text" class="form-control" name="path" placeholder="JSON" aria-label="JSON" aria-describedby="basic-addon6" value="C:/Users/hubert/CODE/pype-setup/repos/pype-config/pype/premiere/example_publish_reqst.json">
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="gui" checked="checked" aria-label="Checkbox for following text input"> GUI
</div>
</div>
</div>
<button id="btn-publish" type="button" class="btn btn-dark btn-sm btn-block">Publish</button>
</li>
</ul>
<hr />
<h5>PPRO function tests:</h5>
<ul class="list-group dark">
<li class="list-group-item"><button id="btn-get-sequence" type="button" class="btn btn-info btn-sm btn-block">Get Sequences</button></li>
<li class="list-group-item"><button id="btn-get-selected" type="button" class="btn btn-info btn-sm btn-block">Get Selected Clips</button></li>
</ul>
<hr />
<div class="col-md-6" id="source">
<!-- <pre>
<code class="python"></code>
</pre> -->
</div>
</div>
<div class="row" id="output">
</div>
</div>
</div>
<h5>Output</h5>
<div class="row" id="output">
<script src="./js/script.js"></script>
</div>
<script src="./js/script.js"></script>
<script src="./js/avalon.js"></script>
</body>
</html>

View file

@ -0,0 +1,59 @@
/* global CSInterface, $, querySelector, api, displayResult */
var csi = new CSInterface();
function deregister () {
api.deregister_plugin_path().then(displayResult);
}
function register () {
var $ = querySelector('#register');
var path = $('input[name=path]').value;
api.register_plugin_path(path).then(displayResult);
}
function publish () {
var $ = querySelector('#publish');
var path = $('input[name=path]').value;
var gui = $('input[name=gui]').checked;
api.publish(path, gui).then(displayResult);
}
function context () {
var $ = querySelector('#context');
var project = $('input[name=project]').value;
var asset = $('input[name=asset]').value;
var task = $('input[name=task]').value;
var app = $('input[name=app]').value;
api.context(project, asset, task, app).then(displayResult);
}
// bind buttons
$('#btn-set-context').click(function () {
context();
});
$('#btn-register').click(function () {
register();
});
$('#btn-deregister').click(function () {
deregister();
});
$('#btn-publish').click(function () {
publish();
});
$('#btn-get-sequence').click(function () {
csi.evalScript('getSequences();', function (result) {
displayResult(result);
});
});
$('#btn-get-selected').click(function () {
$('#output').html('getting selected clips info ...');
csi.evalScript('getSelectedItems();', function (result) {
displayResult(result);
});
});

View file

@ -47,33 +47,7 @@ function unindent(code){
return lines.map(function(s){ return s.substr(margin)}).join('\n');
}
function deregister(){
var $ = querySelector("#deregister");
api.deregister_plugin_path().then(displayResult);
}
function register(){
var $ = querySelector("#register");
var path = $("input[name=path]").value;
api.register_plugin_path(path).then(displayResult);
}
function publish(){
var $ = querySelector("#publish");
var path = $("input[name=path]").value;
var gui = $("input[name=gui]").checked;
api.publish(path, gui).then(displayResult);
}
function context(){
var $ = querySelector("#context");
var project = $("input[name=project]").value;
var asset = $("input[name=asset]").value;
var task = $("input[name=task]").value;
var app = $("input[name=app]").value;
api.context(project,asset,task,app).then(displayResult);
}
//

File diff suppressed because it is too large Load diff

View file

@ -1,714 +0,0 @@
/*
* Angular RangeSlider Directive
*
* Version: 0.0.13
*
* Author: Daniel Crisp, danielcrisp.com
*
* The rangeSlider has been styled to match the default styling
* of form elements styled using Twitter's Bootstrap
*
* Originally forked from https://github.com/leongersen/noUiSlider
*
This code is released under the MIT Licence - http://opensource.org/licenses/MIT
Copyright (c) 2013 Daniel Crisp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
(function() {
'use strict';
// check if we need to support legacy angular
var legacySupport = (angular.version.major === 1 && angular.version.minor === 0);
/**
* RangeSlider, allows user to define a range of values using a slider
* Touch friendly.
* @directive
*/
angular.module('ui-rangeSlider', [])
.directive('rangeSlider', ['$document', '$filter', '$log', function($document, $filter, $log) {
// test for mouse, pointer or touch
var eventNamespace = '.rangeSlider',
defaults = {
disabled: false,
orientation: 'horizontal',
step: 0,
decimalPlaces: 0,
showValues: true,
preventEqualMinMax: false,
attachHandleValues: false
},
// Determine the events to bind. IE11 implements pointerEvents without
// a prefix, which breaks compatibility with the IE10 implementation.
/** @const */
actions = window.navigator.pointerEnabled ? {
start: 'pointerdown',
move: 'pointermove',
end: 'pointerup',
over: 'pointerdown',
out: 'mouseout'
} : window.navigator.msPointerEnabled ? {
start: 'MSPointerDown',
move: 'MSPointerMove',
end: 'MSPointerUp',
over: 'MSPointerDown',
out: 'mouseout'
} : {
start: 'mousedown touchstart',
move: 'mousemove touchmove',
end: 'mouseup touchend',
over: 'mouseover touchstart',
out: 'mouseout'
},
onEvent = actions.start + eventNamespace,
moveEvent = actions.move + eventNamespace,
offEvent = actions.end + eventNamespace,
overEvent = actions.over + eventNamespace,
outEvent = actions.out + eventNamespace,
// get standarised clientX and clientY
client = function(f) {
try {
return [(f.clientX || f.originalEvent.clientX || f.originalEvent.touches[0].clientX), (f.clientY || f.originalEvent.clientY || f.originalEvent.touches[0].clientY)];
} catch (e) {
return ['x', 'y'];
}
},
restrict = function(value) {
// normalize so it can't move out of bounds
return (value < 0 ? 0 : (value > 100 ? 100 : value));
},
isNumber = function(n) {
// console.log(n);
return !isNaN(parseFloat(n)) && isFinite(n);
},
scopeOptions = {
disabled: '=?',
min: '=',
max: '=',
modelMin: '=?',
modelMax: '=?',
onHandleDown: '&', // calls optional function when handle is grabbed
onHandleUp: '&', // calls optional function when handle is released
orientation: '@', // options: horizontal | vertical | vertical left | vertical right
step: '@',
decimalPlaces: '@',
filter: '@',
filterOptions: '@',
showValues: '@',
pinHandle: '@',
preventEqualMinMax: '@',
attachHandleValues: '@',
getterSetter: '@' // Allow the use of getterSetters for model values
};
if (legacySupport) {
// make optional properties required
scopeOptions.disabled = '=';
scopeOptions.modelMin = '=';
scopeOptions.modelMax = '=';
}
// if (EVENT < 4) {
// // some sort of touch has been detected
// angular.element('html').addClass('ngrs-touch');
// } else {
// angular.element('html').addClass('ngrs-no-touch');
// }
return {
restrict: 'A',
replace: true,
template: ['<div class="ngrs-range-slider">',
'<div class="ngrs-runner">',
'<div class="ngrs-handle ngrs-handle-min"><i></i></div>',
'<div class="ngrs-handle ngrs-handle-max"><i></i></div>',
'<div class="ngrs-join"></div>',
'</div>',
'<div class="ngrs-value-runner">',
'<div class="ngrs-value ngrs-value-min" ng-show="showValues"><div>{{filteredModelMin}}</div></div>',
'<div class="ngrs-value ngrs-value-max" ng-show="showValues"><div>{{filteredModelMax}}</div></div>',
'</div>',
'</div>'
].join(''),
scope: scopeOptions,
link: function(scope, element, attrs, controller) {
/**
* FIND ELEMENTS
*/
var $slider = angular.element(element),
handles = [element.find('.ngrs-handle-min'), element.find('.ngrs-handle-max')],
values = [element.find('.ngrs-value-min'), element.find('.ngrs-value-max')],
join = element.find('.ngrs-join'),
pos = 'left',
posOpp = 'right',
orientation = 0,
allowedRange = [0, 0],
range = 0,
down = false;
// filtered
scope.filteredModelMin = modelMin();
scope.filteredModelMax = modelMax();
/**
* FALL BACK TO DEFAULTS FOR SOME ATTRIBUTES
*/
attrs.$observe('disabled', function(val) {
if (!angular.isDefined(val)) {
scope.disabled = defaults.disabled;
}
scope.$watch('disabled', setDisabledStatus);
});
attrs.$observe('orientation', function(val) {
if (!angular.isDefined(val)) {
scope.orientation = defaults.orientation;
}
var classNames = scope.orientation.split(' '),
useClass;
for (var i = 0, l = classNames.length; i < l; i++) {
classNames[i] = 'ngrs-' + classNames[i];
}
useClass = classNames.join(' ');
// add class to element
$slider.addClass(useClass);
// update pos
if (scope.orientation === 'vertical' || scope.orientation === 'vertical left' || scope.orientation === 'vertical right') {
pos = 'top';
posOpp = 'bottom';
orientation = 1;
}
});
attrs.$observe('step', function(val) {
if (!angular.isDefined(val)) {
scope.step = defaults.step;
}
});
attrs.$observe('decimalPlaces', function(val) {
if (!angular.isDefined(val)) {
scope.decimalPlaces = defaults.decimalPlaces;
}
});
attrs.$observe('showValues', function(val) {
if (!angular.isDefined(val)) {
scope.showValues = defaults.showValues;
} else {
if (val === 'false') {
scope.showValues = false;
} else {
scope.showValues = true;
}
}
});
attrs.$observe('pinHandle', function(val) {
if (!angular.isDefined(val)) {
scope.pinHandle = null;
} else {
if (val === 'min' || val === 'max') {
scope.pinHandle = val;
} else {
scope.pinHandle = null;
}
}
scope.$watch('pinHandle', setPinHandle);
});
attrs.$observe('preventEqualMinMax', function(val) {
if (!angular.isDefined(val)) {
scope.preventEqualMinMax = defaults.preventEqualMinMax;
} else {
if (val === 'false') {
scope.preventEqualMinMax = false;
} else {
scope.preventEqualMinMax = true;
}
}
});
attrs.$observe('attachHandleValues', function(val) {
if (!angular.isDefined(val)) {
scope.attachHandleValues = defaults.attachHandleValues;
} else {
if (val === 'true' || val === '') {
// flag as true
scope.attachHandleValues = true;
// add class to runner
element.find('.ngrs-value-runner').addClass('ngrs-attached-handles');
} else {
scope.attachHandleValues = false;
}
}
});
// GetterSetters for model values
function modelMin(newValue) {
if(scope.getterSetter) {
return arguments.length ? scope.modelMin(newValue) : scope.modelMin();
} else {
return arguments.length ? (scope.modelMin = newValue) : scope.modelMin;
}
}
function modelMax(newValue) {
if(scope.getterSetter) {
return arguments.length ? scope.modelMax(newValue) : scope.modelMax();
} else {
return arguments.length ? (scope.modelMax = newValue) : scope.modelMax;
}
}
// listen for changes to values
scope.$watch('min', setMinMax);
scope.$watch('max', setMinMax);
scope.$watch(function () {
return modelMin();
}, setModelMinMax);
scope.$watch(function () {
return modelMax();
}, setModelMinMax);
/**
* HANDLE CHANGES
*/
function setPinHandle(status) {
if (status === "min") {
angular.element(handles[0]).css('display', 'none');
angular.element(handles[1]).css('display', 'block');
} else if (status === "max") {
angular.element(handles[0]).css('display', 'block');
angular.element(handles[1]).css('display', 'none');
} else {
angular.element(handles[0]).css('display', 'block');
angular.element(handles[1]).css('display', 'block');
}
}
function setDisabledStatus(status) {
if (status) {
$slider.addClass('ngrs-disabled');
} else {
$slider.removeClass('ngrs-disabled');
}
}
function setMinMax() {
if (scope.min > scope.max) {
throwError('min must be less than or equal to max');
}
// only do stuff when both values are ready
if (angular.isDefined(scope.min) && angular.isDefined(scope.max)) {
// make sure they are numbers
if (!isNumber(scope.min)) {
throwError('min must be a number');
}
if (!isNumber(scope.max)) {
throwError('max must be a number');
}
range = scope.max - scope.min;
allowedRange = [scope.min, scope.max];
// update models too
setModelMinMax();
}
}
function setModelMinMax() {
if (modelMin() > modelMax()) {
throwWarning('modelMin must be less than or equal to modelMax');
// reset values to correct
modelMin(modelMax());
}
// only do stuff when both values are ready
if (
(angular.isDefined(modelMin()) || scope.pinHandle === 'min') &&
(angular.isDefined(modelMax()) || scope.pinHandle === 'max')
) {
// make sure they are numbers
if (!isNumber(modelMin())) {
if (scope.pinHandle !== 'min') {
throwWarning('modelMin must be a number');
}
modelMin(scope.min);
}
if (!isNumber(modelMax())) {
if (scope.pinHandle !== 'max') {
throwWarning('modelMax must be a number');
}
modelMax(scope.max);
}
var handle1pos = restrict(((modelMin() - scope.min) / range) * 100),
handle2pos = restrict(((modelMax() - scope.min) / range) * 100),
value1pos,
value2pos;
if (scope.attachHandleValues) {
value1pos = handle1pos;
value2pos = handle2pos;
}
// make sure the model values are within the allowed range
modelMin(Math.max(scope.min, modelMin()));
modelMax(Math.min(scope.max, modelMax()));
if (scope.filter && scope.filterOptions) {
scope.filteredModelMin = $filter(scope.filter)(modelMin(), scope.filterOptions);
scope.filteredModelMax = $filter(scope.filter)(modelMax(), scope.filterOptions);
} else if (scope.filter) {
var filterTokens = scope.filter.split(':'),
filterName = scope.filter.split(':')[0],
filterOptions = filterTokens.slice().slice(1),
modelMinOptions,
modelMaxOptions;
// properly parse string and number args
filterOptions = filterOptions.map(function (arg) {
if (isNumber(arg)) {
return +arg;
} else if ((arg[0] == "\"" && arg[arg.length-1] == "\"") || (arg[0] == "\'" && arg[arg.length-1] == "\'")) {
return arg.slice(1, -1);
}
});
modelMinOptions = filterOptions.slice();
modelMaxOptions = filterOptions.slice();
modelMinOptions.unshift(modelMin());
modelMaxOptions.unshift(modelMax());
scope.filteredModelMin = $filter(filterName).apply(null, modelMinOptions);
scope.filteredModelMax = $filter(filterName).apply(null, modelMaxOptions);
} else {
scope.filteredModelMin = modelMin();
scope.filteredModelMax = modelMax();
}
// check for no range
if (scope.min === scope.max && modelMin() == modelMax()) {
// reposition handles
angular.element(handles[0]).css(pos, '0%');
angular.element(handles[1]).css(pos, '100%');
if (scope.attachHandleValues) {
// reposition values
angular.element(values[0]).css(pos, '0%');
angular.element(values[1]).css(pos, '100%');
}
// reposition join
angular.element(join).css(pos, '0%').css(posOpp, '0%');
} else {
// reposition handles
angular.element(handles[0]).css(pos, handle1pos + '%');
angular.element(handles[1]).css(pos, handle2pos + '%');
if (scope.attachHandleValues) {
// reposition values
angular.element(values[0]).css(pos, value1pos + '%');
angular.element(values[1]).css(pos, value2pos + '%');
angular.element(values[1]).css(posOpp, 'auto');
}
// reposition join
angular.element(join).css(pos, handle1pos + '%').css(posOpp, (100 - handle2pos) + '%');
// ensure min handle can't be hidden behind max handle
if (handle1pos > 95) {
angular.element(handles[0]).css('z-index', 3);
}
}
}
}
function handleMove(index) {
var $handle = handles[index];
// on mousedown / touchstart
$handle.bind(onEvent + 'X', function(event) {
var handleDownClass = (index === 0 ? 'ngrs-handle-min' : 'ngrs-handle-max') + '-down',
//unbind = $handle.add($document).add('body'),
modelValue = (index === 0 ? modelMin() : modelMax()) - scope.min,
originalPosition = (modelValue / range) * 100,
originalClick = client(event),
previousClick = originalClick,
previousProposal = false;
if (angular.isFunction(scope.onHandleDown)) {
scope.onHandleDown();
}
// stop user accidentally selecting stuff
angular.element('body').bind('selectstart' + eventNamespace, function() {
return false;
});
// only do stuff if we are disabled
if (!scope.disabled) {
// flag as down
down = true;
// add down class
$handle.addClass('ngrs-down');
$slider.addClass('ngrs-focus ' + handleDownClass);
// add touch class for MS styling
angular.element('body').addClass('ngrs-touching');
// listen for mousemove / touchmove document events
$document.bind(moveEvent, function(e) {
// prevent default
e.preventDefault();
var currentClick = client(e),
movement,
proposal,
other,
per = (scope.step / range) * 100,
otherModelPosition = (((index === 0 ? modelMax() : modelMin()) - scope.min) / range) * 100;
if (currentClick[0] === "x") {
return;
}
// calculate deltas
currentClick[0] -= originalClick[0];
currentClick[1] -= originalClick[1];
// has movement occurred on either axis?
movement = [
(previousClick[0] !== currentClick[0]), (previousClick[1] !== currentClick[1])
];
// propose a movement
proposal = originalPosition + ((currentClick[orientation] * 100) / (orientation ? $slider.height() : $slider.width()));
// normalize so it can't move out of bounds
proposal = restrict(proposal);
if (scope.preventEqualMinMax) {
if (per === 0) {
per = (1 / range) * 100; // restrict to 1
}
if (index === 0) {
otherModelPosition = otherModelPosition - per;
} else if (index === 1) {
otherModelPosition = otherModelPosition + per;
}
}
// check which handle is being moved and add / remove margin
if (index === 0) {
proposal = proposal > otherModelPosition ? otherModelPosition : proposal;
} else if (index === 1) {
proposal = proposal < otherModelPosition ? otherModelPosition : proposal;
}
if (scope.step > 0) {
// only change if we are within the extremes, otherwise we get strange rounding
if (proposal < 100 && proposal > 0) {
proposal = Math.round(proposal / per) * per;
}
}
if (proposal > 95 && index === 0) {
$handle.css('z-index', 3);
} else {
$handle.css('z-index', '');
}
if (movement[orientation] && proposal != previousProposal) {
if (index === 0) {
// update model as we slide
modelMin(parseFloat(parseFloat((((proposal * range) / 100) + scope.min)).toFixed(scope.decimalPlaces)));
} else if (index === 1) {
modelMax(parseFloat(parseFloat((((proposal * range) / 100) + scope.min)).toFixed(scope.decimalPlaces)));
}
// update angular
scope.$apply();
previousProposal = proposal;
}
previousClick = currentClick;
}).bind(offEvent, function() {
if (angular.isFunction(scope.onHandleUp)) {
scope.onHandleUp();
}
// unbind listeners
$document.off(moveEvent);
$document.off(offEvent);
angular.element('body').removeClass('ngrs-touching');
// cancel down flag
down = false;
// console.log('rangeSlider.js off');
var event = new Event('rangeSliderOff');
// Dispatch the event.
window.dispatchEvent(event);
// remove down and over class
$handle.removeClass('ngrs-down');
$handle.removeClass('ngrs-over');
// remove active class
$slider.removeClass('ngrs-focus ' + handleDownClass);
});
}
}).on(overEvent, function () {
$handle.addClass('ngrs-over');
}).on(outEvent, function () {
if (!down) {
$handle.removeClass('ngrs-over');
}
});
}
function throwError(message) {
scope.disabled = true;
throw new Error('RangeSlider: ' + message);
}
function throwWarning(message) {
$log.warn(message);
}
/**
* DESTROY
*/
scope.$on('$destroy', function() {
// unbind event from slider
$slider.off(eventNamespace);
// unbind from body
angular.element('body').off(eventNamespace);
// unbind from document
$document.off(eventNamespace);
// unbind from handles
for (var i = 0, l = handles.length; i < l; i++) {
handles[i].off(eventNamespace);
handles[i].off(eventNamespace + 'X');
}
});
/**
* INIT
*/
$slider
// disable selection
.bind('selectstart' + eventNamespace, function(event) {
return false;
})
// stop propagation
.bind('click', function(event) {
event.stopPropagation();
});
// bind events to each handle
handleMove(0);
handleMove(1);
}
};
}]);
// requestAnimationFramePolyFill
// http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
// shim layer with setTimeout fallback
window.requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
})();
}());

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,16 +0,0 @@
/*
CryptoJS v3.0.2
code.google.com/p/crypto-js
(c) 2009-2012 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(o,q){var l={},m=l.lib={},n=m.Base=function(){function a(){}return{extend:function(e){a.prototype=this;var c=new a;e&&c.mixIn(e);c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.$super.extend(this)}}}(),j=m.WordArray=n.extend({init:function(a,e){a=
this.words=a||[];this.sigBytes=e!=q?e:4*a.length},toString:function(a){return(a||r).stringify(this)},concat:function(a){var e=this.words,c=a.words,d=this.sigBytes,a=a.sigBytes;this.clamp();if(d%4)for(var b=0;b<a;b++)e[d+b>>>2]|=(c[b>>>2]>>>24-8*(b%4)&255)<<24-8*((d+b)%4);else if(65535<c.length)for(b=0;b<a;b+=4)e[d+b>>>2]=c[b>>>2];else e.push.apply(e,c);this.sigBytes+=a;return this},clamp:function(){var a=this.words,e=this.sigBytes;a[e>>>2]&=4294967295<<32-8*(e%4);a.length=o.ceil(e/4)},clone:function(){var a=
n.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var e=[],c=0;c<a;c+=4)e.push(4294967296*o.random()|0);return j.create(e,a)}}),k=l.enc={},r=k.Hex={stringify:function(a){for(var e=a.words,a=a.sigBytes,c=[],d=0;d<a;d++){var b=e[d>>>2]>>>24-8*(d%4)&255;c.push((b>>>4).toString(16));c.push((b&15).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-4*(d%8);return j.create(c,b/2)}},p=k.Latin1={stringify:function(a){for(var b=
a.words,a=a.sigBytes,c=[],d=0;d<a;d++)c.push(String.fromCharCode(b[d>>>2]>>>24-8*(d%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return j.create(c,b)}},h=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(p.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return p.parse(unescape(encodeURIComponent(a)))}},b=m.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=j.create();
this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,c=b.words,d=b.sigBytes,f=this.blockSize,i=d/(4*f),i=a?o.ceil(i):o.max((i|0)-this._minBufferSize,0),a=i*f,d=o.min(4*a,d);if(a){for(var h=0;h<a;h+=f)this._doProcessBlock(c,h);h=c.splice(0,a);b.sigBytes-=d}return j.create(h,d)},clone:function(){var a=n.clone.call(this);a._data=this._data.clone();return a},_minBufferSize:0});m.Hasher=b.extend({init:function(){this.reset()},
reset:function(){b.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);this._doFinalize();return this._hash},clone:function(){var a=b.clone.call(this);a._hash=this._hash.clone();return a},blockSize:16,_createHelper:function(a){return function(b,c){return a.create(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return f.HMAC.create(a,c).finalize(b)}}});var f=l.algo={};return l}(Math);
(function(o){function q(b,f,a,e,c,d,g){b=b+(f&a|~f&e)+c+g;return(b<<d|b>>>32-d)+f}function l(b,f,a,e,c,d,g){b=b+(f&e|a&~e)+c+g;return(b<<d|b>>>32-d)+f}function m(b,f,a,e,c,d,g){b=b+(f^a^e)+c+g;return(b<<d|b>>>32-d)+f}function n(b,f,a,e,c,d,g){b=b+(a^(f|~e))+c+g;return(b<<d|b>>>32-d)+f}var j=CryptoJS,k=j.lib,r=k.WordArray,k=k.Hasher,p=j.algo,h=[];(function(){for(var b=0;64>b;b++)h[b]=4294967296*o.abs(o.sin(b+1))|0})();p=p.MD5=k.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,
2562383102,271733878])},_doProcessBlock:function(b,f){for(var a=0;16>a;a++){var e=f+a,c=b[e];b[e]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360}for(var e=this._hash.words,c=e[0],d=e[1],g=e[2],i=e[3],a=0;64>a;a+=4)16>a?(c=q(c,d,g,i,b[f+a],7,h[a]),i=q(i,c,d,g,b[f+a+1],12,h[a+1]),g=q(g,i,c,d,b[f+a+2],17,h[a+2]),d=q(d,g,i,c,b[f+a+3],22,h[a+3])):32>a?(c=l(c,d,g,i,b[f+(a+1)%16],5,h[a]),i=l(i,c,d,g,b[f+(a+6)%16],9,h[a+1]),g=l(g,i,c,d,b[f+(a+11)%16],14,h[a+2]),d=l(d,g,i,c,b[f+a%16],20,h[a+3])):48>a?(c=
m(c,d,g,i,b[f+(3*a+5)%16],4,h[a]),i=m(i,c,d,g,b[f+(3*a+8)%16],11,h[a+1]),g=m(g,i,c,d,b[f+(3*a+11)%16],16,h[a+2]),d=m(d,g,i,c,b[f+(3*a+14)%16],23,h[a+3])):(c=n(c,d,g,i,b[f+3*a%16],6,h[a]),i=n(i,c,d,g,b[f+(3*a+7)%16],10,h[a+1]),g=n(g,i,c,d,b[f+(3*a+14)%16],15,h[a+2]),d=n(d,g,i,c,b[f+(3*a+5)%16],21,h[a+3]));e[0]=e[0]+c|0;e[1]=e[1]+d|0;e[2]=e[2]+g|0;e[3]=e[3]+i|0},_doFinalize:function(){var b=this._data,f=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;f[e>>>5]|=128<<24-e%32;f[(e+64>>>9<<4)+14]=(a<<8|a>>>
24)&16711935|(a<<24|a>>>8)&4278255360;b.sigBytes=4*(f.length+1);this._process();b=this._hash.words;for(f=0;4>f;f++)a=b[f],b[f]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360}});j.MD5=k._createHelper(p);j.HmacMD5=k._createHmacHelper(p)})(Math);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,65 +0,0 @@
/*
Copyright (C) 2015 Ivan Maeder
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-
Prevent computer or display sleep with HTML5/JavaScript. Include this
file then use the following:
sleep.prevent()
sleep.allow()
*/
var sleep = {
prevent: function() {
if (!this._video) {
this._init();
}
this._video.setAttribute('loop', 'loop');
this._video.play();
},
allow: function() {
if (!this._video) {
return;
}
this._video.removeAttribute('loop');
this._video.pause();
},
_init: function() {
this._video = document.createElement('video');
this._video.setAttribute('width', '10');
this._video.setAttribute('height', '10');
this._video.style.position = 'absolute';
this._video.style.top = '-10px';
this._video.style.left = '-10px';
var source_mp4 = document.createElement('source');
source_mp4.setAttribute('src', 'https://github.com/ivanmaeder/computer-sleep/raw/master/resources/muted-blank.mp4');
source_mp4.setAttribute('type', 'video/mp4');
this._video.appendChild(source_mp4);
var source_ogg = document.createElement('source');
source_ogg.setAttribute('src', 'https://github.com/ivanmaeder/computer-sleep/raw/master/resources/muted-blank.ogv');
source_ogg.setAttribute('type', 'video/ogg');
this._video.appendChild(source_ogg);
document.body.appendChild(this._video);
},
_video: null
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long