Permalink
Browse files

Init.

  • Loading branch information...
0 parents commit 1f8977eb0c9ea1fcb288a563f3a3de5addf1ecae Sören committed Jun 13, 2012
@@ -0,0 +1,13 @@
+chrome.webRequest.onBeforeRequest.addListener(function(details) {
+ if (details.url.indexOf("explicit=true") != -1) {
+ return {
+ url: 'https://www.facebook.com/ajax/mercury/change_read_status.php?__a=1'
+ }
+ }
+ else {
+ return {
+ cancel: true
+ }
+ }
+}, { urls: ["*://*.facebook.com/*change_read_status*"] }, ["blocking"]
+)
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
@@ -0,0 +1,25 @@
+{
+ "name": "FB unseen",
+ "version": "0.0.3",
+ "manifest_version": 2,
+ "description": "Blocks the \"seen\" feature of the facebook messenger.",
+ "background": {
+ "scripts": ["background.js"]
+ },
+ "content_scripts": [
+ {
+ "matches": ["*://*.facebook.com/*"],
+ "js": ["jquery.js", "read_button.js"]
+ }
+ ],
+ "permissions": [
+ "webRequest",
+ "webRequestBlocking",
+ "*://*.facebook.com/*"
+ ],
+ "icons": {
+ "16": "icon16.png",
+ "48": "icon48.png",
+ "128": "icon128.png"
+ }
+}
@@ -0,0 +1,38 @@
+function get_thread_id() {
+ var chunk = $('script:contains("thread_id")').text()
+ var pos = chunk.indexOf('(')
+ var data = JSON.parse(chunk.slice(pos + 1, chunk.length - 1)) // somewhere in there are some "thread_id"s
+}
+
+function add_read_buttons() {
+ $('.fbMercuryChatTab').each(function(i) {
+ if ($(this).find('.mark_as_read').length == 0) {
+ // a.titlebarText
+ // .fbChatConvItem a.profileLink
+ $(this).find('.typingIndicator').after('<a><div class="mark_as_read inputbutton">Mark as read</div></a>')
+ $(this).find('.mark_as_read').click(function() {
+ var dtsg = $('input[name="fb_dtsg"]').attr('value')
+ var re = /user=(\d*)/
+ var user = re.exec($('a.topborder').attr('ajaxify'))[1]
+ var thread_id = get_thread_id()
+ $.ajax({
+ type: 'POST',
+ url: 'https://www.facebook.com/ajax/mercury/change_read_status.php?__a=1&explicit=true',
+ data: {
+ 'ids[id.xxxxxxxxxxxxxxx]': true, // x are digits
+ 'fb_dtsg': dtsg,
+ '__user': user
+ //"phstamp": "xxxxxxxxxxxxxxxxxxxxxxx" // seems irrelevant
+ }
+ })
+ })
+ }
+ })
+}
+
+$(document).ready(function() {
+ $('#fbDockChatTabs').bind('DOMNodeInserted', function() {
+ add_read_buttons()
+ })
+ add_read_buttons()
+})
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 1f8977e

Please sign in to comment.