mirror of https://github.com/calzoneman/sync.git
parent
78ecc042d6
commit
1ee3c06213
|
@ -44,7 +44,8 @@ var Channel = function(name) {
|
|||
qopen_allow_delete: false,
|
||||
allow_voteskip: true,
|
||||
pagetitle: this.name,
|
||||
customcss: ""
|
||||
customcss: "",
|
||||
customjs: ""
|
||||
};
|
||||
this.filters = [
|
||||
[/`([^`]+)`/g , "<code>$1</code>" , true],
|
||||
|
@ -97,7 +98,9 @@ Channel.prototype.loadDump = function() {
|
|||
if(this.media && data.currentTime) {
|
||||
this.media.currentTime = data.currentTime;
|
||||
}
|
||||
this.opts = data.opts;
|
||||
for(var key in data.opts) {
|
||||
this.opts[key] = data.opts[key];
|
||||
}
|
||||
if(data.filters) {
|
||||
this.filters = new Array(data.filters.length);
|
||||
for(var i = 0; i < data.filters.length; i++) {
|
||||
|
|
|
@ -0,0 +1,247 @@
|
|||
/* =========================================================
|
||||
* bootstrap-modal.js v2.3.1
|
||||
* http://twitter.github.com/bootstrap/javascript.html#modals
|
||||
* =========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache 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://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
* ========================================================= */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* MODAL CLASS DEFINITION
|
||||
* ====================== */
|
||||
|
||||
var Modal = function (element, options) {
|
||||
this.options = options
|
||||
this.$element = $(element)
|
||||
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
|
||||
this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
|
||||
}
|
||||
|
||||
Modal.prototype = {
|
||||
|
||||
constructor: Modal
|
||||
|
||||
, toggle: function () {
|
||||
return this[!this.isShown ? 'show' : 'hide']()
|
||||
}
|
||||
|
||||
, show: function () {
|
||||
var that = this
|
||||
, e = $.Event('show')
|
||||
|
||||
this.$element.trigger(e)
|
||||
|
||||
if (this.isShown || e.isDefaultPrevented()) return
|
||||
|
||||
this.isShown = true
|
||||
|
||||
this.escape()
|
||||
|
||||
this.backdrop(function () {
|
||||
var transition = $.support.transition && that.$element.hasClass('fade')
|
||||
|
||||
if (!that.$element.parent().length) {
|
||||
that.$element.appendTo(document.body) //don't move modals dom position
|
||||
}
|
||||
|
||||
that.$element.show()
|
||||
|
||||
if (transition) {
|
||||
that.$element[0].offsetWidth // force reflow
|
||||
}
|
||||
|
||||
that.$element
|
||||
.addClass('in')
|
||||
.attr('aria-hidden', false)
|
||||
|
||||
that.enforceFocus()
|
||||
|
||||
transition ?
|
||||
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
|
||||
that.$element.focus().trigger('shown')
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
, hide: function (e) {
|
||||
e && e.preventDefault()
|
||||
|
||||
var that = this
|
||||
|
||||
e = $.Event('hide')
|
||||
|
||||
this.$element.trigger(e)
|
||||
|
||||
if (!this.isShown || e.isDefaultPrevented()) return
|
||||
|
||||
this.isShown = false
|
||||
|
||||
this.escape()
|
||||
|
||||
$(document).off('focusin.modal')
|
||||
|
||||
this.$element
|
||||
.removeClass('in')
|
||||
.attr('aria-hidden', true)
|
||||
|
||||
$.support.transition && this.$element.hasClass('fade') ?
|
||||
this.hideWithTransition() :
|
||||
this.hideModal()
|
||||
}
|
||||
|
||||
, enforceFocus: function () {
|
||||
var that = this
|
||||
$(document).on('focusin.modal', function (e) {
|
||||
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
|
||||
that.$element.focus()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
, escape: function () {
|
||||
var that = this
|
||||
if (this.isShown && this.options.keyboard) {
|
||||
this.$element.on('keyup.dismiss.modal', function ( e ) {
|
||||
e.which == 27 && that.hide()
|
||||
})
|
||||
} else if (!this.isShown) {
|
||||
this.$element.off('keyup.dismiss.modal')
|
||||
}
|
||||
}
|
||||
|
||||
, hideWithTransition: function () {
|
||||
var that = this
|
||||
, timeout = setTimeout(function () {
|
||||
that.$element.off($.support.transition.end)
|
||||
that.hideModal()
|
||||
}, 500)
|
||||
|
||||
this.$element.one($.support.transition.end, function () {
|
||||
clearTimeout(timeout)
|
||||
that.hideModal()
|
||||
})
|
||||
}
|
||||
|
||||
, hideModal: function () {
|
||||
var that = this
|
||||
this.$element.hide()
|
||||
this.backdrop(function () {
|
||||
that.removeBackdrop()
|
||||
that.$element.trigger('hidden')
|
||||
})
|
||||
}
|
||||
|
||||
, removeBackdrop: function () {
|
||||
this.$backdrop && this.$backdrop.remove()
|
||||
this.$backdrop = null
|
||||
}
|
||||
|
||||
, backdrop: function (callback) {
|
||||
var that = this
|
||||
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
||||
|
||||
if (this.isShown && this.options.backdrop) {
|
||||
var doAnimate = $.support.transition && animate
|
||||
|
||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||
.appendTo(document.body)
|
||||
|
||||
this.$backdrop.click(
|
||||
this.options.backdrop == 'static' ?
|
||||
$.proxy(this.$element[0].focus, this.$element[0])
|
||||
: $.proxy(this.hide, this)
|
||||
)
|
||||
|
||||
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
||||
|
||||
this.$backdrop.addClass('in')
|
||||
|
||||
if (!callback) return
|
||||
|
||||
doAnimate ?
|
||||
this.$backdrop.one($.support.transition.end, callback) :
|
||||
callback()
|
||||
|
||||
} else if (!this.isShown && this.$backdrop) {
|
||||
this.$backdrop.removeClass('in')
|
||||
|
||||
$.support.transition && this.$element.hasClass('fade')?
|
||||
this.$backdrop.one($.support.transition.end, callback) :
|
||||
callback()
|
||||
|
||||
} else if (callback) {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* MODAL PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
||||
var old = $.fn.modal
|
||||
|
||||
$.fn.modal = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('modal')
|
||||
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('modal', (data = new Modal(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
else if (options.show) data.show()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.modal.defaults = {
|
||||
backdrop: true
|
||||
, keyboard: true
|
||||
, show: true
|
||||
}
|
||||
|
||||
$.fn.modal.Constructor = Modal
|
||||
|
||||
|
||||
/* MODAL NO CONFLICT
|
||||
* ================= */
|
||||
|
||||
$.fn.modal.noConflict = function () {
|
||||
$.fn.modal = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
/* MODAL DATA-API
|
||||
* ============== */
|
||||
|
||||
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
|
||||
var $this = $(this)
|
||||
, href = $this.attr('href')
|
||||
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
||||
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
$target
|
||||
.modal(option)
|
||||
.one('hide', function () {
|
||||
$this.focus()
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
|
@ -0,0 +1,60 @@
|
|||
/* ===================================================
|
||||
* bootstrap-transition.js v2.3.1
|
||||
* http://twitter.github.com/bootstrap/javascript.html#transitions
|
||||
* ===================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache 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://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
* ========================================================== */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
|
||||
* ======================================================= */
|
||||
|
||||
$(function () {
|
||||
|
||||
$.support.transition = (function () {
|
||||
|
||||
var transitionEnd = (function () {
|
||||
|
||||
var el = document.createElement('bootstrap')
|
||||
, transEndEventNames = {
|
||||
'WebkitTransition' : 'webkitTransitionEnd'
|
||||
, 'MozTransition' : 'transitionend'
|
||||
, 'OTransition' : 'oTransitionEnd otransitionend'
|
||||
, 'transition' : 'transitionend'
|
||||
}
|
||||
, name
|
||||
|
||||
for (name in transEndEventNames){
|
||||
if (el.style[name] !== undefined) {
|
||||
return transEndEventNames[name]
|
||||
}
|
||||
}
|
||||
|
||||
}())
|
||||
|
||||
return transitionEnd && {
|
||||
end: transitionEnd
|
||||
}
|
||||
|
||||
})()
|
||||
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
|
@ -66,6 +66,7 @@ function initCallbacks() {
|
|||
document.title = opts.pagetitle;
|
||||
PAGETITLE = opts.pagetitle;
|
||||
$("#opt_customcss").val(opts.customcss);
|
||||
$("#opt_customjs").val(opts.customjs);
|
||||
$("#customCss").remove();
|
||||
if(opts.customcss.trim() != "") {
|
||||
$("<link/>").attr("rel", "stylesheet")
|
||||
|
@ -74,6 +75,9 @@ function initCallbacks() {
|
|||
.insertAfter($("link[href='./assets/css/ytsync.css']"));
|
||||
}
|
||||
$("#opt_allow_voteskip").prop("checked", opts.allow_voteskip);
|
||||
if(opts.customjs.trim() != "") {
|
||||
$.getScript(opts.customjs);
|
||||
}
|
||||
|
||||
CHANNELOPTS = opts;
|
||||
if(opts.qopen_allow_qnext)
|
||||
|
|
|
@ -287,7 +287,8 @@ $("#opt_submit").click(function() {
|
|||
qopen_allow_playnext: $("#opt_qopen_allow_playnext").prop("checked"),
|
||||
allow_voteskip: $("#opt_allow_voteskip").prop("checked"),
|
||||
pagetitle: ptitle,
|
||||
customcss: css
|
||||
customcss: css,
|
||||
customjs: $("#opt_customjs").val()
|
||||
};
|
||||
socket.emit("channelOpts", opts);
|
||||
});
|
||||
|
|
|
@ -144,15 +144,20 @@
|
|||
<input type="text" id="opt_pagetitle" placeholder="Sync" class="pull-right">
|
||||
</label>
|
||||
<br>
|
||||
<label>Custom CSS<sup class="text-warning">BETA</sup>
|
||||
<label>Custom CSS
|
||||
<input type="text" id="opt_customcss" class="pull-right">
|
||||
</label>
|
||||
<br>
|
||||
<label>Custom JS<sup class="text-warning">BETA</sup>
|
||||
<input type="text" id="opt_customjs" class="pull-right">
|
||||
</label>
|
||||
<br>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" id="opt_allow_voteskip">
|
||||
Allow voteskip
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="span10">
|
||||
<button class="btn btn-primary" id="opt_submit">Save</button>
|
||||
</div>
|
||||
|
@ -201,19 +206,51 @@
|
|||
</div>
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
<div id="userOpts" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="userOptsLbl" aria-hidden="true" data-backdrop="false">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Options</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="javascript:void(0);">
|
||||
<fieldset>
|
||||
<label>Layout</label>
|
||||
<select id="uopt_layout">
|
||||
<option value="default">Default</option>
|
||||
<option value="large">Large</option>
|
||||
<option value="huge">Huge</option>
|
||||
<option value="narrow">Narrow</option>
|
||||
<option value="synchtube">Synchtube</option>
|
||||
</select>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" id="uopt_playlist_follow">
|
||||
Playlist follows current video
|
||||
</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- APIs -->
|
||||
<script src="http://api.dmcdn.net/all.js"></script>
|
||||
<script src="./assets/js/sc.js"></script>
|
||||
<script src="./assets/js/froogaloop.min.js"></script>
|
||||
<script src="./assets/js/swf.js"></script>
|
||||
<!-- Third party -->
|
||||
<script src="./assets/js/jquery.js"></script>
|
||||
<script src="./assets/js/webtoolkit.sha256.js" type="text/javascript"></script>
|
||||
<script src="./assets/js/bootstrap.js"></script>
|
||||
<script src="./assets/js/bootstrap-transition.js"></script>
|
||||
<script src="./assets/js/bootstrap-modal.js"></script>
|
||||
<script src="./socket.io/socket.io.js"></script>
|
||||
<!-- My Javascript -->
|
||||
<script src="./assets/js/functions.js"></script>
|
||||
<script src="./assets/js/callbacks.js"></script>
|
||||
<script src="./assets/js/iourl.js"></script>
|
||||
<script src="./assets/js/media.js"></script>
|
||||
<script src="./assets/js/client.js"></script>
|
||||
<script src="./assets/js/swf.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue