Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
daattali committed Mar 28, 2015
0 parents commit 8fb780f
Show file tree
Hide file tree
Showing 13 changed files with 278 additions and 0 deletions.
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Dean Attali

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.

40 changes: 40 additions & 0 deletions README.md
@@ -0,0 +1,40 @@
# Google Slides Auto Resize Speaker Notes (Chrome extension)

_Dean Attali_
_February-March 2015_
_Source code available [on GitHub](https://github.com/daattali/gslides-betternotes-extension)_
_Get the extension at the [Chrome Web Store](TODO)_


## Description

The slide previews in the Speaker Notes window of Google Slides are tiny and unreadable. This extension dynamically resizes the slides based on the window size to make them useful.

If you've ever used Google Slides (or MS PowerPoint/anything similar), you may be aware of the Speaker Notes feature - it allows you to view the current and next slides as well as the text notes for the current slide . However, for some weird reason, the Speaker Notes in Google Slides only allocates a very small area for the slides preview, while giving the notes almost all the space. There is no possible way to resize the slide thumbnail, which makes the slide preview almost useless.

With this Chrome extension, the slide preview images will be automatically resized to take up most of the window becuase it just makes sense. You don't need 80% of your screen to show you the notes, you want to be able to see the slide and just dedicate a small portion to the notes. The resizing is dynamic and will happen if you drag the window to be smaller/larger. You can also specify how much space to give the notes (which means the slide previews get the rest of the space).


## Demo

If you don't have a Google Slides document to experiment with/verify this problem, you can test it out with [this sample Google Slides presentation](https://docs.google.com/presentation/d/18svsKPFNQrBLOSAmOouD410kX9fuaNp3e1K1GTTBLiU/edit?usp=sharing)

Here is a 30-second GIF that shows a demo of this extension:

![Demo](./img/doc/demo.gif)

## Motivation

As preparation for my committee meeting, I used Google Slides to make my presentation. Shortly after starting, before havin any actual content in my presentation, I noticed that the Speaker Notes window is basically useless in its current form because of how small the slide previes are. After fiddling with the speaker notes window JavaScript and CSS for a couple hours, I decided that a much better use of my time instead of working on my committee meeting would be to make this extension. I then proceeded to spend the next several hours making the draft version of this extension, and thus successfully procrastinated from my real work for many many hours!

On a more serious note - I do think this is a very essential tool for anyone who uses Google Slides to give presentations.

## Other extensions

[GitHub Diff Navigator](https://github.com/daattali/github-diff-navigator-extension) - Chrome extension that allows you to easily navigate through the changes in a file that has been edited on GitHub.

[Smileyfy My Facebook](https://github.com/daattali/smileyfy-my-facebook-extension) - Chrome extension that adds infinite happiness to your Facebook browsing, plus a little bonus rickrolling :)

---

To see my other projects, visit [http://deanattali.com/projects](http://deanattali.com/projects)
14 changes: 14 additions & 0 deletions css/pft-adblock-inject.css
@@ -0,0 +1,14 @@
#pft-adblock-overlay {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index:10000;
background: rgba(0,0,0,0.9);
bottom: 0;
color: #FFFFFF;
text-align: center;
font-size: 50px;
font-weight: bold;
padding-top: 350px;
}
39 changes: 39 additions & 0 deletions css/pft-adblock-popup.css
@@ -0,0 +1,39 @@
body {
width: 350px;
text-align: center;
}

#pft-adblock-title {
font-size:1.4em;
margin-bottom: 10px;
}

#pft-adblock-options {
text-align: left;
font-size: 1.2em;
}

#pft-adblock-options-enabled {
margin-top: 7px;
}

#pft-adblock-options input[type=checkbox] {
position: relative;
top: 2px;
}

#pft-adblock-footer {
margin-top: 7px;
position: relative;
}

#pft-adblock-copyright {
color: #888888;
font-size: 1em;
}

#pft-adblock-link {
text-decoration: underline;
cursor: pointer;
color: inherit;
}
23 changes: 23 additions & 0 deletions html/pft-adblock-popup.html
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Project Free TV Ad Bypass</title>
<link rel="stylesheet" type="text/css" href="../css/pft-adblock-popup.css">
<script src="../js/pft-adblock-popup.js"></script>
</head>

<body>
<div id="pft-adblock-title">Project Free TV Ad Bypass</div><hr>
<div id="pft-adblock-options">
<div>Whenever you encounter a Project Free TV ad page, this extension will automatically redirect to the video.</div>
<input type="checkbox" name="pft-adblock-options" id="pft-adblock-options-enabled" />
<label for="pft-adblock-options-enabled">Enable</label>
</div>
<div id="pft-adblock-footer">
<span id="pft-adblock-copyright">
&copy; 2015
<a id="pft-adblock-link" href="http://deanattali.com" target="_blank">Dean Attali</a>
</span>
</div>
</body>
</html>
Binary file added img/icon-128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon-16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon-48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions js/pft-adblock-background.js
@@ -0,0 +1,18 @@
var pftAdblockBackground = {
init : function() {
chrome.runtime.onInstalled.addListener(function() {
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { urlMatches: '.*/www.free-tv-video-online.info/.*' },
})
],
actions: [ new chrome.declarativeContent.ShowPageAction() ]
}]);
});
});
}
};

pftAdblockBackground.init();
56 changes: 56 additions & 0 deletions js/pft-adblock-inject.js
@@ -0,0 +1,56 @@
var pftAdblockInject = {
init : function() {
chrome.storage.sync.get({
enabled : true
}, function(storage) {
if (storage.enabled) {
pftAdblockInject.attemptBypassAd();
}
});

},

attemptBypassAd : function() {
if (!pftAdblockInject.isAdPage()) {
return;
}
if (pftAdblockInject.getVideoPageUrl() === null) {
return;
}
pftAdblockInject.bypassAd()
},

isExtensionEnabled : function() {

},

isAdPage : function() {
return (window.location.pathname.indexOf("interstitial2.html") != -1)
},

getVideoPageUrl : function() {
var lnk = pftAdblockInject.getUrlParam("lnk");
return (lnk === null ? null : decodeURIComponent(lnk));
},

bypassAd : function() {
window.location.href = pftAdblockInject.getVideoPageUrl();

pftAdblockInject.addOverlay();
},

getUrlParam : function(name) {
var url = window.location.href;
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return results == null ? null : results[1];
},

addOverlay : function() {
document.body.innerHTML += '<div id="pft-adblock-overlay">Redirecting to video...</strong>';
}
};

pftAdblockInject.init();
26 changes: 26 additions & 0 deletions js/pft-adblock-popup.js
@@ -0,0 +1,26 @@
var pftAdblockPopup = {
// init: on page load, restore the saved options and add listeners to changing them
init : function() {
pftAdblockPopup.restoreOptions();

document.getElementById('pft-adblock-options-enabled').addEventListener('change', pftAdblockPopup.saveOptions);
},

restoreOptions : function() {
chrome.storage.sync.get({
enabled : true
}, function(storage) {
document.getElementById('pft-adblock-options-enabled').checked = storage.enabled;
});
},

// saveOption: an option was changed, save it
saveOptions : function() {
var enabled = document.getElementById('pft-adblock-options-enabled').checked;
chrome.storage.sync.set({
enabled : enabled
});
}
};

document.addEventListener('DOMContentLoaded', pftAdblockPopup.init);
40 changes: 40 additions & 0 deletions manifest.json
@@ -0,0 +1,40 @@
{
"name": "Project Free TV Ad Bypass",
"version": "0.1.0",
"manifest_version": 2,
"description": "Project Free TV serves a 10-second ad page before allowing users to continue to the video - this extension bypasses the ad page.",
"page_action": {
"default_popup": "html/pft-adblock-popup.html",
"default_title": "Project Free TV Ad Bypass"
},
"background": {
"scripts": [
"js/pft-adblock-background.js"
],
"persistent": false
},
"permissions" : [
"declarativeContent",
"storage"
],
"options_page": "html/pft-adblock-popup.html",
"icons": {
"16": "img/icon-16.png",
"48": "img/icon-48.png",
"128": "img/icon-128.png"
},
"content_scripts": [
{
"matches": [
"http://www.free-tv-video-online.info/*"
],
"js": [
"js/pft-adblock-inject.js"
],
"css": [
"css/pft-adblock-inject.css"
]
}
],
"homepage_url": "https://github.com/daattali/pft-ad-bypass-extension"
}

0 comments on commit 8fb780f

Please sign in to comment.