Beispiel #1
0
var onfullscreentoggle = function (e) {
  if (!isFullscreen && e.shiftKey) {
    ipc.send('resize', {
      width: media.width,
      height: media.height,
      ratio: media.ratio
    })
    return
  }

  var $icon = $('#controls-fullscreen .mega-octicon')
  if (isFullscreen) {
    isFullscreen = false
    $('#titlebar')[0].style.display = 'block'
    $icon.removeClass('octicon-screen-normal')
    $icon.addClass('octicon-screen-full')
    ipc.send('exit-full-screen')
  } else {
    isFullscreen = true
    $('#titlebar')[0].style.display = 'none'
    $icon.removeClass('octicon-screen-full')
    $icon.addClass('octicon-screen-normal')
    ipc.send('enter-full-screen')
  }
}
Beispiel #2
0
function updateTimelineTooltip(e) {
  var tooltip = $('#controls-timeline-tooltip')[0]
  var percentage = e.pageX / $('#controls-timeline')[0].offsetWidth
  var time =  formatTime(percentage * media.duration)
  tooltip.innerHTML = time
  tooltip.style.left = (e.pageX - tooltip.offsetWidth / 2) + "px"
}
Beispiel #3
0
$('#controls-broadcast').on('click', function () {
  $('#popup')[0].className = 'broadcast'
  $('#controls-playlist')[0].className = ''
  $('#controls-broadcast').toggleClass('selected')
  chromecasts.update()
  updatePopup()
})
Beispiel #4
0
media.on('play', function () {
  ipc.send('prevent-sleep')
  $('#splash').toggleClass('hidden', !media.casting)
  $('#player').toggleClass('hidden', media.casting)
  $('#controls-play .octicon-playback-play').removeClass('octicon-playback-play')
  $('#controls-play .mega-octicon').addClass('octicon-playback-pause')
})
Beispiel #5
0
TitleBar.prototype.appendTo = function(target) {
	if(typeof target === 'string') target = $(target)[0];
	if(this._options.style !== false) defaultcss('titlebar', style);

	var $element = $(this.element);

	$window.on('keydown', this._onkeydown = function(e) {
		if(e.keyCode === ALT) $element.addClass('alt');
	});

	$window.on('keyup', this._onkeyup = function(e) {
		if(e.keyCode === ALT) $element.removeClass('alt');
	});

	target.appendChild(this.element);

    this.on('close', function () {
		remote.getCurrentWindow().close();
	});

    this.on('minimize', function () {
		remote.getCurrentWindow().minimize();
	});

    this.on('fullscreen', function () {
		var win = remote.getCurrentWindow();
		if (win.isMaximized())
			win.unmaximize();
		else
			win.maximize();
	});

	return this;
};
Beispiel #6
0
var updatePopup = function () {
  if (popupSelected()) {
    $('#popup')[0].style.display = 'block'
    $('#popup')[0].style.opacity = 1
  } else {
    $('#popup')[0].style.opacity = 0
  }
}
Beispiel #7
0
$(document).on('keydown', function (e) {
  if (e.keyCode === 27 && isFullscreen) return onfullscreentoggle(e)
  if (e.keyCode === 13 && e.metaKey) return onfullscreentoggle(e)
  if (e.keyCode === 13 && e.shiftKey) return onfullscreentoggle(e)
  if (e.keyCode === 32) return onplaytoggle(e)

  if ($('#controls-playlist').hasClass('selected')) $('#controls-playlist').trigger('click')
  if ($('#controls-chromecast').hasClass('selected')) $('#controls-chromecast').trigger('click')
})
Beispiel #8
0
media.on('play', function () {
  if (media.casting) {
    $('#splash')[0].className = ''
    $('#player')[0].className = 'hidden'
  } else {
    $('#splash')[0].className = 'hidden'
    $('#player')[0].className = ''
  }
  $('#controls-play .mega-octicon')[0].className = 'mega-octicon octicon-playback-pause'
})
Beispiel #9
0
$('#controls-playlist').on('click', function (e) {
  if ($('#controls-playlist').hasClass('selected')) {
    closePopup()
    return
  }

  $('#popup')[0].className = 'playlist'
  $('#controls .controls-secondary .selected').removeClass('selected')
  $('#controls-playlist').addClass('selected')
  updatePopup()
})
Beispiel #10
0
  list.entries.forEach(function (entry, i) {
    if (!entry.downloadSpeed) return

    $('.playlist-entry[data-index="' + i + '"] .status').addClass('octicon-sync')

    var kilobytes = entry.downloadSpeed() / 1024
    var megabytes = kilobytes / 1024
    var text = megabytes > 1 ? megabytes.toFixed(1) + ' mb/s' : Math.floor(kilobytes) + ' kb/s'

    if (list.selected === entry) $('#player-downloadspeed')[0].innerText = text
  })
Beispiel #11
0
$('#chromecast-entries').on('click', '.chromecast-entry', function (e) {
  var id = Number(this.getAttribute('data-id'))
  var player = chromecasts.players[id]

  if (media.casting === player) {
    $('body').removeClass('chromecasting')
    media.chromecast(null)
    return updateChromecast()
  }

  $('body').addClass('chromecasting')
  media.chromecast(player)
  updateChromecast()
})
Beispiel #12
0
Web.prototype.appendTo = function(element) {
	if(typeof element === 'string') element = $(element)[0];
	if(this._options.style !== false) defaultcss('web', style);

	var self = this;

	element.appendChild(this.element);
	this.fillParent();

	$(window).on('resize', debounce(function() {
		self.fillParent();
	}));

	return this;
};
Beispiel #13
0
$('#controls-volume-slider').on('mousemove', function (e) {
  if (isVolumeSliderClicked) {
    var volume = $('#controls-volume-slider')[0]
    updateAudioVolume(volume.value)
    updateVolumeSlider(volume)
  }
})
Beispiel #14
0
list.on('select', function () {
  //$('#controls-name')[0].innerText = list.selected.name
  $('.titletop')[0].innerText = list.selected.name
  media.play('http://127.0.0.1:' + server.address().port + '/' + list.selected.id)
  if (list.selected.subtitles) onsubs(list.selected.subtitles)
  updatePlaylist()
})
Beispiel #15
0
$('#controls-pbrate-slider').on('mousemove', function (e) {
  if (isPbrateSliderClicked) {
    var volume = $('#controls-pbrate-slider')[0]
    updatePlaybackRate(volume.value)
    updatePlaybackRateSlider(volume)
  }
})
Beispiel #16
0
var drag = function(element) {
	element = $(element);

	var offset = null;
	var mouse = mouseConstructor();

	var onmousedown = function(e) {
		offset = [e.clientX, e.clientY];
	};

	element.on('mousedown', onmousedown);

	mouse.on('left-drag', function(x, y) {
		if(!offset) return;

		x = Math.round(x - offset[0]);
		y = Math.round(y - offset[1]);

		remote.getCurrentWindow().setPosition(x, y);
	});

	mouse.on('left-up', function() {
		offset = null;
	});

	return function() {
		element.off('mousedown', onmousedown);
		mouse.destroy();
	};
};
Beispiel #17
0
var updatePlaylist = function () {
  var html = ''

  list.entries.forEach(function (entry, i) {
    html += '<div class="playlist-entry ' + (i % 2 ? 'odd ' : '') + (list.selected === entry ? 'selected ' : '') + '" data-index="' + i + '" data-id="' + entry.id + '">' +
      '<span>' + entry.name + '</span><span class="status octicon"></span></div>'
  })

  $('#playlist-entries')[0].innerHTML = html
}
Beispiel #18
0
var updateChromecast = function () {
  var html = ''

  chromecasts.players.forEach(function (player, i) {
    html += '<div class="chromecast-entry ' + (i % 2 ? 'odd ' : '') + (media.casting === player ? 'selected ' : '') + '" data-index="' + i + '" data-id="' + i + '">' +
      '<span>' + player.name + '</span>'
  })

  $('#chromecast-entries')[0].innerHTML = html
}
returnUserData = function(user) {
	console.log(user.data);
	user = user.data;
	var content =
		"<h1>" + user.name +"</h1>" +
		"<ul>" +
			"<li> <strong>Link Karma:</strong> " + user.link_karma + "</li>" +
			"<li> <strong>Comment Karma:</strong> " + user.comment_karma + "</li>" +
		"</ul>";
	$('.user')[0].innerHTML = content;
};
Beispiel #20
0
media.on('metadata', function () {
  // TODO: comment in again when not quirky
  // if (!isFullscreen) {
  //   ipc.send('resize', {
  //     width: media.width,
  //     height: media.height,
  //     ratio: media.ratio
  //   })
  // }

  $('#controls-main')[0].style.display = 'block'
  $('#controls-time-total')[0].innerText = formatTime(media.duration)
  $('#controls-time-current')[0].innerText = formatTime(media.time())

  clearInterval(updateInterval)
  updateInterval = setInterval(function () {
    $('#controls-timeline-position')[0].style.width = (100 * (media.time() / media.duration)) + '%'
    $('#controls-time-current')[0].innerText = formatTime(media.time())
  }, 250)
})
Beispiel #21
0
var Web = function(options) {
	if(!(this instanceof Web)) return new Web(options);

	events.EventEmitter.call(this);
	options = options || {};
	this._options = options;

	var element = domify(html);
	this.element = element;
	this.canvas = $('canvas', element)[0];
	this.url = null;
};
Beispiel #22
0
var TitleBar = function(options) {
	if(!(this instanceof TitleBar)) return new TitleBar(options);

	events.EventEmitter.call(this);
	this._options = options || {};

	var element = domify(html);
	var $element = $(element);
	this.element = element;

	if(this._options.draggable !== false) $element.addClass('webkit-draggable');

	var self = this;
	var close = $('.titlebar-close', element)[0];
	var minimize = $('.titlebar-minimize', element)[0];
	var fullscreen = $('.titlebar-fullscreen', element)[0];
	if(this._options.only ===true)
	{
		minimize.style.display='none';
		fullscreen.style.display='none';
	}

	$element.on('click', function(e) {
		var target = e.target;
		if(close.contains(target)) self.emit('close', e);
		else if(minimize.contains(target)) self.emit('minimize', e);
		else if(fullscreen.contains(target)) {
			if(e.altKey) self.emit('maximize', e);
			else self.emit('fullscreen', e);
		}
	});

	$element.on('dblclick', function(e) {
		var target = e.target;
		if(close.contains(target) || minimize.contains(target) || fullscreen.contains(target)) return;
		self.emit('maximize', e);
	});
};
Beispiel #23
0
var onrepeatcycle = function () {
  var $controlsRepeat = $('#controls-repeat')
  if (!list.repeating) {
    $controlsRepeat.addClass('repeating')
    list.repeat()
    return
  }

  if (!list.repeatingOne) {
    $controlsRepeat.addClass('one')
    list.repeatOne()
    return
  }

  $controlsRepeat.removeClass('repeating')
  $controlsRepeat.removeClass('one')
  list.unrepeat()
}
Beispiel #24
0
var $ = require('dombo');
var spawn = require('child_process').spawn;
var Promise = require('bluebird');
var adb = require('adbkit');
var client = adb.createClient();
var fs = require('fs');
var StreamPng = require('StreamPng');
var serial = document.querySelector('#serial');
var command = document.querySelector('#command');

$('#ls-button').on('click', function () {
  console.log('ls');
  list()
})

$('#capture-button').on('click', function () {
  console.log('run ' + serial.value);
  screencap(serial.value);
})

$('#command-button').on('click', function () {
  //console.log('run ' + serial.value);
  //run(command.value);
  run2(serial.value, command.value);
  //run2(serial.value, "pull /sdcard/tmp.mp4");
  setTimeout(function (){
    pull(serial.value, '/sdcard/tmp.mp4');
  }, 1000);

})
Beispiel #25
0
var fixtures = path.resolve(__dirname, '')
function openSendMailDialog () {
   sendBrowserWindow = new BrowserWindow({
      show: true,
      width: 400,
      height: 400
    })

    sendBrowserWindow.webContents.on('did-finish-load', function () {
        sendBrowserWindow.webContents.openDevTools()
        try {
          sendBrowserWindow.webContents.debugger.attach()
        } catch (err) {
          assert(sendBrowserWindow.webContents.debugger.isAttached())
        }
      })
      //alert('file://' + path.join(fixtures, '', 'sentMail.html'))
      sendBrowserWindow.webContents.loadURL('file://' + path.join(fixtures, '', 'sentMail.html'))
}



$('#sendMail').on('click', openSendMailDialog)

window.addEventListener('unload', function (e) {
  if (sendBrowserWindow != null) {
     sendBrowserWindow.destroy()
   }
   sendBrowserWindow = null
}, false);
Beispiel #26
0
var events = require('events');
var util = require('util');
var fs = require('fs');
var defaultcss = require('defaultcss');
var domify = require('domify');
var $ = require('dombo');

var electron = require('electron');
var ipcRenderer = electron.ipcRenderer;
var remote = electron.remote;

var ALT = 18;

var $window = $(window);
var style = fs.readFileSync(__dirname + '/index.css', 'utf-8');
var html = fs.readFileSync(__dirname + '/index.html', 'utf-8');

var TitleBar = function(options) {
	if(!(this instanceof TitleBar)) return new TitleBar(options);

	events.EventEmitter.call(this);
	this._options = options || {};

	var element = domify(html);
	var $element = $(element);
	this.element = element;

	if(this._options.draggable !== false) $element.addClass('webkit-draggable');

	var self = this;
	var close = $('.titlebar-close', element)[0];
Beispiel #27
0
media.on('pause', function () {
  ipc.send('allow-sleep')
  $('#controls-play .octicon-playback-pause').removeClass('octicon-playback-pause')
  $('#controls-play .mega-octicon').addClass('octicon-playback-play')
})
Beispiel #28
0
 updateInterval = setInterval(function () {
   $('#controls-timeline-position')[0].style.width = (100 * (media.time() / media.duration)) + '%'
   $('#controls-time-current')[0].innerText = formatTime(media.time())
 }, 250)
Beispiel #29
0
$('#popup').on('transitionend', function () {
  if (!popupSelected()) $('#popup')[0].style.display = 'none'
})
Beispiel #30
0
var closePopup = function (e) {
  if (e && (e.target === $('#controls-playlist .mega-octicon')[0] || e.target === $('#controls-chromecast .chromecast')[0])) return
  $('#popup')[0].style.opacity = 0
  $('#controls-playlist').removeClass('selected')
  $('#controls-chromecast').removeClass('selected')
}