-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
277 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h3>Wakatime Hangout</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* global gapi, gadgets, $ */ | ||
|
||
var logoUrl = 'https://wakatime.com/static/img/wakatime-white-120.png'; | ||
var overlayEffect = null; | ||
|
||
function sendHeartbeat(file, time, project, language, isWrite, lines) { | ||
// TODO | ||
} | ||
|
||
function createTextOverlay(string) { | ||
// Create a canvas to draw on | ||
var canvas = document.createElement('canvas'); | ||
canvas.setAttribute('width', 166); | ||
canvas.setAttribute('height', 100); | ||
|
||
var context = canvas.getContext('2d'); | ||
|
||
// Draw background | ||
context.fillStyle = '#BBB'; | ||
context.fillRect(0,0,166,50); | ||
|
||
// Draw text | ||
context.font = '16pt Impact'; | ||
context.lineWidth = 6; | ||
context.lineStyle = '#000'; | ||
context.fillStyle = '#FFF'; | ||
context.fillColor = '#ffff00'; | ||
context.fillColor = '#ffff00'; | ||
context.textAlign = 'center'; | ||
context.textBaseline = 'bottom'; | ||
context.strokeText(string, canvas.width / 2, canvas.height / 2); | ||
context.fillText(string, canvas.width / 2, canvas.height / 2); | ||
|
||
return canvas.toDataURL(); | ||
} | ||
|
||
function showOverlay() { | ||
var options = {}; | ||
//var overlayImage = gapi.hangout.av.effects.createImageResource(logoUrl); | ||
var overlayImage = gapi.hangout.av.effects.createImageResource(createTextOverlay('Time: 00:00:23')); | ||
overlayEffect = overlayImage.createOverlay(options); | ||
overlayEffect.setVisible(true); | ||
} | ||
|
||
function startApp() { | ||
gapi.hangout.onair.onYouTubeLiveIdReady.add( | ||
function(eventObject) { | ||
}); | ||
|
||
gapi.hangout.onParticipantsChanged.add( | ||
function(eventObject) { | ||
}); | ||
|
||
gapi.hangout.onair.onBroadcastingChanged.add( | ||
function(eventObject) { | ||
}); | ||
|
||
gapi.hangout.onair.onNewParticipantInBroadcastChanged.add( | ||
function(eventObject) { | ||
}); | ||
|
||
gapi.hangout.onTopicChanged.add( | ||
function(eventObject) { | ||
}); | ||
|
||
gapi.hangout.onTopicChanged.add( | ||
function(eventObject) { | ||
}); | ||
|
||
} | ||
|
||
function init() { | ||
// When API is ready... | ||
gapi.hangout.onApiReady.add( | ||
function(eventObj) { | ||
// TODO | ||
showOverlay(); | ||
}); | ||
} | ||
|
||
// Wait for gadget to load. | ||
gadgets.util.registerOnLoadHandler(init); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
body { | ||
color: #ffffff; | ||
background-color: #000000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Module> | ||
<!-- 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 | ||
--> | ||
<ModulePrefs title="Wakatime Gadget"> | ||
<Require feature="rpc" /> | ||
<Require feature="views" /> | ||
<Require feature="locked-domain" /> | ||
</ModulePrefs> | ||
<Content type="html"><![CDATA[ | ||
<html> | ||
<head> | ||
<style> | ||
body { | ||
color: #ffffff; | ||
background-color: #000000; | ||
} | ||
</style> | ||
<!-- inject:css --> | ||
<!-- endinject --> | ||
</head> | ||
<body> | ||
<script src="//plus.google.com/hangouts/_/api/v1/hangout.js"></script> | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | ||
<h3>Wakatime Hangout</h3> | ||
<script> | ||
/* global gapi, gadgets, $ */ | ||
var logoUrl = 'https://wakatime.com/static/img/wakatime-white-120.png'; | ||
var overlayEffect = null; | ||
function sendHeartbeat(file, time, project, language, isWrite, lines) { | ||
// TODO | ||
} | ||
function createTextOverlay(string) { | ||
// Create a canvas to draw on | ||
var canvas = document.createElement('canvas'); | ||
canvas.setAttribute('width', 166); | ||
canvas.setAttribute('height', 100); | ||
var context = canvas.getContext('2d'); | ||
// Draw background | ||
context.fillStyle = '#BBB'; | ||
context.fillRect(0,0,166,50); | ||
// Draw text | ||
context.font = '16pt Impact'; | ||
context.lineWidth = 6; | ||
context.lineStyle = '#000'; | ||
context.fillStyle = '#FFF'; | ||
context.fillColor = '#ffff00'; | ||
context.fillColor = '#ffff00'; | ||
context.textAlign = 'center'; | ||
context.textBaseline = 'bottom'; | ||
context.strokeText(string, canvas.width / 2, canvas.height / 2); | ||
context.fillText(string, canvas.width / 2, canvas.height / 2); | ||
return canvas.toDataURL(); | ||
} | ||
function showOverlay() { | ||
var options = {}; | ||
//var overlayImage = gapi.hangout.av.effects.createImageResource(logoUrl); | ||
var overlayImage = gapi.hangout.av.effects.createImageResource(createTextOverlay('Time: 00:00:23')); | ||
overlayEffect = overlayImage.createOverlay(options); | ||
overlayEffect.setVisible(true); | ||
} | ||
function startApp() { | ||
gapi.hangout.onair.onYouTubeLiveIdReady.add( | ||
function(eventObject) { | ||
}); | ||
gapi.hangout.onParticipantsChanged.add( | ||
function(eventObject) { | ||
}); | ||
gapi.hangout.onair.onBroadcastingChanged.add( | ||
function(eventObject) { | ||
}); | ||
gapi.hangout.onair.onNewParticipantInBroadcastChanged.add( | ||
function(eventObject) { | ||
}); | ||
gapi.hangout.onTopicChanged.add( | ||
function(eventObject) { | ||
}); | ||
gapi.hangout.onTopicChanged.add( | ||
function(eventObject) { | ||
}); | ||
} | ||
function init() { | ||
// When API is ready... | ||
gapi.hangout.onApiReady.add( | ||
function(eventObj) { | ||
// TODO | ||
showOverlay(); | ||
}); | ||
} | ||
// Wait for gadget to load. | ||
gadgets.util.registerOnLoadHandler(init); | ||
</script> | ||
<!-- inject:js --> | ||
<!-- endinject --> | ||
</body> | ||
]]> | ||
</Content> | ||
</Module> |