Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The initial version.

  • Loading branch information...
commit eb93ca05c6b0f3d531821d6a28d664c8be87f3c7 0 parents
@punkhacker authored
BIN  128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2  README.markdown
@@ -0,0 +1,2 @@
+A [browser extension](http://likeplusone.org/) that reduces your risk of getting
+carpal tunnel syndrome up to 50% by turning Like into Like+1 buttons.
22 background.html
@@ -0,0 +1,22 @@
+<!--
+ The markup for a background page that manages interest data.
+
+ Copyright 2011 Ashkan Soltani and Brian Kennish
+
+ 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/>.
+
+ Authors (one per line):
+
+ Brian Kennish <byoogle@gmail.com>
+-->
+<script src="background.js"></script>
37 background.js
@@ -0,0 +1,37 @@
+/*
+ The script for a background page that manages interest data.
+
+ Copyright 2011 Ashkan Soltani and Brian Kennish
+
+ 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/>.
+
+ Authors (one per line):
+
+ Brian Kennish <byoogle@gmail.com>
+*/
+
+/* Destringifies an object. */
+function deserialize(object) {
+ return typeof object == 'string' ? JSON.parse(object) : object;
+}
+
+/* The saved like+1s. */
+var likeplusones = deserialize(localStorage.likeplusones) || {};
+
+/* Adds or removes a like+1. */
+chrome.extension.onRequest.addListener(function(request) {
+ var page = request.page;
+ request.likeplusoned ? likeplusones[page] = Date.now() :
+ delete likeplusones[page];
+ localStorage.likeplusones = JSON.stringify(likeplusones);
+});
81 content.css
@@ -0,0 +1,81 @@
+/*
+ A content style sheet that munges Like buttons.
+
+ Copyright 2011 Ashkan Soltani and Brian Kennish
+
+ 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/>.
+
+ Authors (one per line):
+
+ Brian Kennish <byoogle@gmail.com>
+*/
+.likeplusone {
+ min-width: 96px;
+ min-height: 24px
+}
+
+.connect_widget_number_cloud { width: 56px !important }
+
+.uiGrid .thumbs_up_icon,
+.connect_widget_like_button.like_button_like .tombstone_cross {
+ margin-right: 0
+}
+
+.uiGrid .thumbs_up_icon {
+ background-image: none;
+ width: 0
+}
+
+.connect_widget_number_cloud_summary .connect_widget_connected_text,
+.connect_widget_number_cloud_summary .connect_widget_not_connected_text {
+ font-size: 16px
+}
+
+.connect_widget_like_button.clearfix { padding: 2px 4px }
+
+.connect_widget_like_button.like_button_like .tombstone_cross,
+.connect_widget_like_button.clearfix.like_button_like .tombstone_cross:hover,
+.connect_widget_like_button.clearfix.like_button_no_like .liketext {
+ background-position: 0
+}
+
+.connect_widget_like_button.like_button_like .tombstone_cross,
+.like_button_no_like .liketext {
+ width: 48px;
+ height: 18px
+}
+
+.connect_widget_like_button.like_button_like .tombstone_cross {
+ background-image:
+ url(chrome-extension://lpehokhlnomihmdpgoclgbapaglbclfg/likeplusone.png)
+}
+
+.connect_widget_like_button.clearfix.like_button_no_like .liketext {
+ background-image:
+ url(chrome-extension://lpehokhlnomihmdpgoclgbapaglbclfg/unlikeplusone.png);
+ padding-left: 0
+}
+
+.connect_widget_like_button.like_button_like .liketext, .hidden {
+ display: none
+}
+
+.uiGrid .connect_widget_button_count_count {
+ padding-top: 2px;
+ padding-bottom: 4px;
+ font-size: 12px
+}
+
+.fbSendButton { left: 64px !important }
+
+.connect_confirmation_cell { left: 118px !important }
67 content.js
@@ -0,0 +1,67 @@
+/*
+ A content script that munges Like buttons.
+
+ Copyright 2011 Ashkan Soltani and Brian Kennish
+
+ 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/>.
+
+ Authors (one per line):
+
+ Brian Kennish <byoogle@gmail.com>
+*/
+
+/* Messages the page and Like+1 state internally and a + or -1 externally. */
+function likeplusone(likeplusoned) {
+ var page =
+ location.href.indexOf(like, 7) >= 7 ?
+ decodeURIComponent(location.search.split('href=', 2)[1].split('&', 1))
+ : location;
+ chrome.extension.sendRequest({page: page, likeplusoned: likeplusoned});
+ $('head').append(
+ '<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>'
+ );
+ $('body').append(
+ '<div class="hidden"><g:plusone href="' + page + '"></g:plusone></div>'
+ );
+
+ setTimeout(function() {
+ $('[src*="plusone.google.com/u/0/_/+1/button"]').
+ attr('src', function(index, source) { return source += '#like+1'; });
+ }, timeout);
+}
+
+/* The, partial, URL of the Like iframe. */
+var like = 'www.facebook.com/plugins/like.php';
+
+/* The +1 timeout, in milliseconds. */
+var timeout = 2000;
+
+$('[src*="' + like + '"]').addClass('likeplusone');
+
+/* Splits the like stream. */
+$('.connect_widget_like_button').
+ click(function() { likeplusone(true); }).
+ children('.liketext').html('');
+
+/* Splits the unlike stream. */
+$('.tombstone_cross').click(function() { likeplusone(); });
+
+/* Simulates a click on the +1 button. */
+setTimeout(function() {
+ if (location.hash.split('#').pop() == 'like+1') {
+ // jQuery seems to bite the bag here.
+ var click = document.createEvent('MouseEvents');
+ click.initMouseEvent('click', true, true);
+ document.getElementById('button').dispatchEvent(click);
+ }
+}, timeout);
8,936 jquery.js
8,936 additions, 0 deletions not shown
BIN  likeplusone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 manifest.json
@@ -0,0 +1,27 @@
+{
+ "name": "Like+1",
+ "version": "1.0.0",
+ "description":
+ "Reduce your risk of getting carpal tunnel syndrome up to 50% by turning Like into Like+1 buttons.",
+ "icons": {"48": "48.png", "128": "128.png"},
+ "permissions": [
+ "background",
+ "chrome://favicon/",
+ "contextMenus",
+ "cookies",
+ "history",
+ "idle",
+ "notifications",
+ "unlimitedStorage",
+ "http://*/*",
+ "https://*/*"
+ ],
+ "background_page": "background.html",
+ "content_scripts": [{
+ "matches": ["http://*/*", "https://*/*"],
+ "css": ["content.css"],
+ "js": ["jquery.js", "content.js"],
+ "run_at": "document_end",
+ "all_frames": true
+ }]
+}
BIN  unlikeplusone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.