Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	background.js
  • Loading branch information
zusorio committed Aug 3, 2019
2 parents 664481e + 0aa5b42 commit 37fd81b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
@@ -0,0 +1 @@
ko_fi: zusordev
9 changes: 8 additions & 1 deletion README.md
@@ -1,4 +1,11 @@
# GoodTwitter
Removes twitters stupid redesign in chrome by changing the user agent on all requests to twitter.
I don't really know any JS or anything about addons, pull requests are appreciated.
This was built in 10 minutes, so good luck.
This was built in 10 minutes, so good luck.

## Installation
This extension is available on [Chrome Web Store](https://chrome.google.com/webstore/detail/goodtwitter/jbanhionoclikdjnjlcmefiofgjimgca).

## License
This extension is released under the [MIT License](https://opensource.org/licenses/MIT).
See [LICENSE](LICENSE) for more details.
38 changes: 20 additions & 18 deletions background.js
@@ -1,25 +1,27 @@
var requestFilter = {
urls: ["https://*.twitter.com/*"]
},
"use strict";

extraInfoSpec = ['requestHeaders', 'blocking'],
// Chrome will call your listener function in response to every
// HTTP request
handler = function (details) {
const requestFilter = {
urls: ["https://*.twitter.com/*"]
};

var headers = details.requestHeaders,
blockingResponse = {};
const extraInfoSpec = ['requestHeaders', 'blocking'];
// Chrome will call your listener function in response to every
// HTTP request
const handler = function (details) {

for (var i = 0, l = headers.length; i < l; ++i) {
if (headers[i].name === 'User-Agent') {
headers[i].value = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) Waterfox/56.2';
break;
}
let headers = details.requestHeaders;
let blockingResponse = {};
const l = headers.length;
for (let i = 0; i < l; ++i) {
if (headers[i].name === 'User-Agent') {
headers[i].value = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) Waterfox/56.2';
break;
}
}

blockingResponse.requestHeaders = headers;
return blockingResponse;
};
blockingResponse.requestHeaders = headers;
return blockingResponse;
};

function removeCookie() {
chrome.browsingData.remove({"origins": ["https://twitter.com"]}, {"cacheStorage": true, "cache": true});
Expand All @@ -31,4 +33,4 @@ function removeCookie() {
}

chrome.webRequest.onBeforeSendHeaders.addListener(handler, requestFilter, extraInfoSpec);
chrome.runtime.onInstalled.addListener(removeCookie);
chrome.runtime.onInstalled.addListener(removeCookie);
25 changes: 25 additions & 0 deletions troubleshooting.md
@@ -0,0 +1,25 @@
# Troubleshooting
If the add-on isn't working for you, try these steps

# The add-on isn't working/stopped working
This is for when you're suddenly back to new twitter or never got back to old twitter.
For other issues check known issues below or [submit a new issue](https://github.com/ZusorCode/GoodTwitterChrome/issues).

First, try hard refreshing twitter. Shift+Click on [reload](https://i.imgur.com/b6wAyvY.png) in the twitter tab.

If that didn't work, try reinstalling goodtwitter by going to the [store page](https://chrome.google.com/webstore/detail/goodtwitter/jbanhionoclikdjnjlcmefiofgjimgca),
clicking remove then installing it again.

Next, try clearing cookies for twitter. Click on [the lock](https://i.imgur.com/mrN3So1.png),
then click [cookies](https://i.imgur.com/ubaejpk.png). Now just click [remove](https://i.imgur.com/xck2mxL.png) NOT BLOCK for ALL OF THEM.
You'll have to log back in. That should fix most issues.

You can also try restarting chrome or your computer.

If all that didn't work create an issue on GitHub [here](https://github.com/ZusorCode/GoodTwitter/issues)
# Known issues
## Videos/GIFs are not loading
This happens sometimes. Shift+Click on [reload](https://i.imgur.com/Eai0GOG.png) and it should be fixed.
Refer to issue [#9](https://github.com/ZusorCode/GoodTwitter/issues/9).
## Videos are Pitched down
No fix yet. Issue [#6](https://github.com/ZusorCode/GoodTwitter/issues/6).

0 comments on commit 37fd81b

Please sign in to comment.