How to make something like AdCloseGold? - google-chrome-extension

I'm frequently dealing with websites that open a bunch of new tabs with ads and I'm tired of it.
A while back I discovered AdCloseGold which is a Chrome extension that automatically closes all tabs that open a specified URL and I've happily used it for a while now.
Unfortunately, AdCloseGold has a few shortcomings:
1) No wildcards in the url
2) A limited amount of urls one can ad (because it stores the data in a Google account)
3) Doesn't close blank pages or page not found.
4) Doesn't have a button or something that says "add THIS page to auto close", meaning you have to copy and paste all urls manually into the list.
5) Doesn't provide any prewritten list of urls.
Recently I've started using the hosts file, redirecting urls to a nonsense address and then close that address through AdCloseGold, meaning I need just one address to auto close, but that has quite some problems as well, because the hosts file requires the full url, i.e. adding xyz.com to the hosts file doesn't redirect abc.xyz.com.
Furthermore, I do not really want to redirect all of these urls permanently but rather only in Chrome, so I can still access those pages through Firefox or IE.
I'm a (hobby) coder and I don't mind the work, I consider it more fun than work, but I only have some rudimentary knowledge of how to make a Chrome extension.
So the question is: Does a Chrome extension like an advanced AdCloseGold already exist and if not (I couldn't find any) where would I find a detailed enough tutorial for Chrome extensions, where I could learn this?

Author of Ad Close Gold here. I'm aware of the shortcoming you mentioned in your question. I've really wanted to add those to the add-on but never really can find the time to do so. I first created the add-on just for myself and it was fine for me. I thought I'd share the add-on with everyone since, even till this day, I cannot find any add-on that will auto-close tabs for me.
I have the source code for the add-on on github: https://github.com/mukunku/Ad-Close-Gold
Feel free to fork the repository and make any changes. You can create a separate add-on or merge the code back to my project if you like. If you merge the code back to mine, I can release it as a new version (And give you credit of course).
P.S. Wild cards are technically supported. If you use a regular expression as the URL and enable the IsRegEx option, it will work.
For example: www.ali.*.com
This will match all of the following:
www.aliexpress.com
www.aliother.com
www.ali.com

Related

Re-using existing browser tabs when starting a new process

Right now I'm using Process.Start(URL_Here) to open a new page in the web browser - it will either open a browser or a new tab if one is already running. I was wondering, is there any reasonable (i.e. the one which won't require any 'hacks') way to re-use already opened tabs? - by "re-use" I mean a situation when f.e. www.google.com is already opened, I want to open a google page again, but instead of opening a new google tab it will redirect to the one that is already opened. Thanks for any help.
This sounds like standard browser behavior, and it's unlikely you'll be able to change it with simple command line arguments.
If you're willing to use Chrome and give every piece of data you transmit to The Company of Great Evil, then here's a plugin that can reuse a tab if you're using the same URL.

No-Content-Script for chrome extension

I may be a bit of paranoid when it comes to installing chrome extension that request access to all my tabs and data. While a extension may be safe for the moment, a simple auto background update can make it a malicious virus and you won't even get notified about updates.
I would like to specifically whitelist all my extension to access the content pear webpages bases. Is there any such tool out there already (natively perhaps) before i start hacking my own extension to control it on my own.
That would leave me to my next question. Extension can be a bit secured running sandboxed environment and have no access to the "real" filesystem (not the virtual sandboxed filesystem) but could i write a NaCl plugin and have have full access and change the manifest file to change the content_scripts settings? if so, could you point me in the right direction?
I'm not sure to understand clearly your question, but let's calrify some things about extensions and how they can be dangerous:
First: If an extension updates and want to have new authorisations, Chrome will warn you and you can choose if you want it to be updated
Second: Chrome sandboxes extensions running on your computer
Third: The only authorisation that may represent a real danger for your computer are the ones requesting authorisation to "Access all data on your computer"
.
.
.
If you are really worried that some extensions may represent a danger for you (and I understand you), you can restrict them to run on specific webpages by doing the following:
1. Go to the extensions folders [C:\Users(YOUR USERNAME)\AppData\Local\Google\Chrome\User Data\Default\Extensions(APPID)] and open the manifest.json file with any text editor
2. In "content_scripts" declaration, in "matches", specify sites where the extension will ONLY work on [ex:*://google.com/* will make extension be active ONLY for google.com]
You can even be more precise and set specific URLs/HTML pages (see more: https://developer.chrome.com/extensions/match_patterns)
Hope it helps!
If it doesn't, please clarify your question again.

launch google search from link

I am running a website based on php on a server run by a large host. My goal is very simple. Include link on my site to google search where I dynamically give the search term.
Starting with the url that appears in the address bar, I've narrowed the syntax down to
http://www.google.com/search?q=test
This works when I type it into the address bar. However, when I launch from the server, it redirects to:
www.google.com/webhp...lots of characters
There are references on the web to webhp being related to a virus but I'm pretty sure my host does not have any viruses on its servers.
Does anyone know proper way to launch simple google search from a link? Is a straight link forbidden? I am Willing to use JS to push link to client if necessary (which I use for google maps at Google's recommendation due to usage limits) but want to keep things as simple as possible. This link is just to save people a few clicks.
Thanks for any suggestions.
Simply use the urlencode Method
<?php
echo '<a href="http://www.google.com/search?q=', urlencode($userinput), '">';
?>
If you wish to do it with Javascript the answer is here: Encode URL in JavaScript?
Try to track down the "Url Rewriting", I think its a virus you need to remove: http://www.ehow.com/how_8728291_rid-webhp.html
WebHP is a computer virus that automatically sets your homepage to a
fake Google site, known as Google.com/WebHP. This virus will also
randomly open windows or tabs to load this website, as well as
generate pop-ups and fake errors. Also installed with this virus is a
rootkit which can disable your PC's firewall and other methods of
security. If left untreated, the WebHP virus allows hackers to
remotely access your computer and steal personal information, such as
credit card numbers and email passwords.

truly persistent localStorage or workaround for history clear

For my company I've created a RSS reader extension for our internal blog. The reason why I've build my own is irrelevant, I know there are many existings extensions. Suffice to say that the blog is completely sealed of from the outside. And let's not forget that it's simply fun to try new things like this :)
The extensions works almost perfectly. It shows a nice popup with the latest 10 posts and it shows a counter if new posts have been added to the blog.
However, since most of my collegaes are webdevelopers like myself, some of them use firefox ( the extension is being ported by an automated script for use in FF ) and have the "clear history on browser close" option enabled. This does however delete the localstorage as well. I know that this setting is the issue and not the porting because my collegae that do not have the option selected don't experience any of these problems.
I use localStorage to remember which posts have been read and which haven't. So for these people the result is that every browser restart the extensions says there are 10 new items regardless of any items they may or may not have read.
I've thought of a way to work around this issue by using a MySQL database through php and ajax. But I'd still need to reliably be able to store a userId or something to personalize the read/unread list.
There must be an easier and better way. I know many extensions with similar functionality that do not have this issue but I've got no idea how and can't find anything about it.
Do any of you have an idea ?
Thanks!
I just tried my own Chrome extension using chrome.storage.sync API.
The storage won't be deleted if you clear all the history and local cache.
I've only built Chrome extensions, not FF ones, but if you have access to the file system, you can store the data in a simple text file. To be honest, I'd blame the developers for clearing their history. ;)

Making a EXISTING CMS site compatible for mobile site NOT REDIRECT

Making a EXISTING CMS site compatible for mobile site NOT REDIRECT
Hi All.
I am currently creating a mobile version of an expression engine site that we use.
I am having problems with this, because typically I can just use media quires, or use redirect scripts.
However, the layout of the mobile site will be completely different from the desktop, so I can't just fiddle with a media quires for the CSS (as site just looks to different).
I was thinking of using a javascript to wipe the code or markup (php) if the device is mobile BUT it would mean perhaps loading two versions of code anytime a page loads up (not good for mobile). Eg one code for desktop and another for mobile.
I can't change the file names eg (mobile_index) because it is a CMS and the links wont link up correctly. I have tried this a few times , and also editing the .HTACCESS file, but it simply didnt work.
So if anyone knows how do I change the code of a page if the device mobile, but cant change file name, directory or any of that :-)
Cheers
Daragh
Why no redirect? If I was in your position, which I was a few months ago, I would handle this totally different:
Install Multiple Site Manager by ExpressionEngine: http://expressionengine.com/user_guide/cp/sites/index.html
Add another site -- mobile
Give it a proper domainname like m.domain.com
Give it its own template group
... and redirect with http://github.com/sebarmeli/JS-Redirection-Mobile-Site/
Now you can manage both installations from the same CMS and both installations can access existing channels, modules, extensions and members. This will keep your code fast and clean.
Adding a bunch of conditionals will only slow down installation.
Actually you could mess with media queries - it's the most flexible. JS is really overkill for something like this. At larger sizes, UL>LI menus could appear, and at smaller sizes they could be hidden (display:none) and swapped to select lists; divs can be replaced, elements dropped or resized. I also combine them with different snippets or embeds so you can tailor the content out as well.
You might try something like MX Mobile Device Detect. It gives you some variables that can detect if the user is on a mobile device that you could use in conditionals in your templates.

Resources