Thursday, March 2, 2017

My ad-block script

Why not using an add-on/extension like adblock etc.? Because many sites now block them! And they tend to block some wanted content while leave some unwanted unblocked.

You'll need to install the Greasemonkey (Firefox) or Violent Monkey (Chrome, Yandex and Opera). Then add a new script and copy & paste. All dynamic contents are removed; so be sure to add to the "NOT_TO_REMOVE" list the iframe src's that you do want to see! Or you may add exceptional line(s) like this within metadata block:

// @exclude     http://www.example.com/foo/baz

Now your browsers should be totally quiet without any unwanted moving stuff. Timers are removed too!

Related article: KoT's Dynamic Content BlockerMy script for blocking GIF

This script has been (on 03/09/2017) and will be updated without notice

// ==UserScript==
// @name         Block Marquee
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @include      http*://*/*
// @exclude      https://xfinity.nnu.com/xfinitywifi/main
// @exclude      https://www.blogger.com/*
// @exclude      https://groups.google.com/forum/*
// @grant        none
// ==/UserScript==
    
/* add your items to be not blocked */

var NOT_TO_REMOVE = 'iframe' +
':not([src*=\'youtu\'])' +
':not([src*=\'dailymotion\'])' +
':not([src*=\'youku\'])' +
':not([src*=\'tudou\'])' +
':not([src*=\'powermv\'])' +
':not([src*=\'dramafever\'])' +
':not([src*=\'vimeo\'])' +
':not([src*=\'liveguidestationplayer\'])' +
':not([src*=\'RoutePositionET\'])' +
':not([src*=\'blogger.com\'])' +
':not([src*=\'chase.com\'])' +
':not([src*=\'/tob/live/usp-core\'])'
;

/* add your items to be blocked */

var TO_REMOVE = 'div[id*=\'carousel\']' +
',div[id*=\'Carousel\']' 
;

function doRemove() {

  var m, i;
  
  if (window.top == window.self) {
      m = document.querySelectorAll(NOT_TO_REMOVE);
      for (var i = 0; i < m.length; i++) {
        m[i].parentNode.removeChild(m[i]);
      }
  }
  
  m = document.querySelectorAll(TO_REMOVE);
  for (i = 0; i < m.length; i++) {
    m[i].parentNode.removeChild(m[i]);
  }
  
  // Thanks to http://stackoverflow.com/a/8345837
  // Set a fake timeout to get the highest timeout id
  var highestTimeoutId = setTimeout(";");
  for (i = 0 ; i < highestTimeoutId ; i++) {
      clearTimeout(i); 
  }

}

var m, i;

/* block Special items */

m = document.getElementById('scrollWrap');
if (m !== null) {
  m.id = 'scrollWrap_';
  m = document.getElementById('scrollMsg');
  if (m !== null) {
    m.parentNode.removeChild(m);
  }
}

/* block common items */

m = document.getElementsByTagName('marquee');
for (i = 0; i < m.length; i++) {
  var p = document.createElement('div');
  p.innerHTML = m[0].innerHTML;
  p.setAttribute('style', 'width: 100%; clear: both;');
  m[0].parentNode.insertBefore(p, m[0]);
  m[0].parentNode.removeChild(m[0]);
}

//Don't run on frames or iframes
if (window.top !== window.self) 
    return;

doRemove(); window.addEventListener('load', doRemove, false);

Wednesday, March 1, 2017

The only acceptable browser for Android: Yandex

Since I upgraded my Nexus 6 to the latest OS 7.1.1, I have been searching for a browser that does these two simple things:

1) Text wrapping (text-reflow, auto-fit)
2) Remember passwords

Without text wrapping, I don't know how anybody could read anything on the phone's small screen. As for password-remember, it is virtually impossible for anyone to type in passwords over and over again on the phone's tiny keyboard.


Yandex and Opera are the only two can do these two simple things, believe it or not. I didn't try FireFox and Chrome though, because they suck, they use too much resources and run phone hot. I pick Yandex over Opera, because it is quite a hassle to use tabs with Opera and it sometimes drains battery while phone is idling.


Yandex has some very thoughtful features too. For example, address bar is at the bottom, as you see in above first photo. It is auto-hidden, and, the best part, I only need to move the page down just a little bit to let it appear. Because it is based on the same source code of Chrome, so all Chrome and Opera extensions work with Yandex! I use the Autofill extension to remember the few passwords that Yandex won't. Yes, all, I mean ALL, passwords can be remembered! So this Yandex really works for everything you do on a desktop computer! You can even block Youtube ads with one of such extensions!


I cannot say enough how great Yandex is. I do have one complaint: cannot disable the stupid preview mode; so have to double touch for each and every site. Apple invented two great things that ruined user experience on every smartphone: one is swipe to answer a call and the other is this preview mode.

The followings are the ones I tried but could not do at least one of the above two simple things:

Boat
Dolphin
Next
Naked
Via
UC (text is often messily formatted)
Maxthon
Flynx
Ghostery
Lightning

There might be even more, but I can no longer remember.

PS: There are few sites that Autofill cannot automatically add their username and password. "reg.usps.com" is one of them, but can be easily added manually:

Sunday, February 26, 2017

How to extract Wechat voice messages

1) The voice messages are stored under /sdccard/tencent/MicroMsg/[akskjdkdkdjdkdkdajhueiieuiuowpq]/voice2. Each voice message has its own folder and is an amr file. Copy these *.amr files from your phone to your PC.

2) Download "wechat_silk" utility from here and extract the "wechat_silk.exe" file onto your computer. Drag the amr files and drop them onto "wechat_silk.exe". You'll get *.wav files on your desktop.

Now you can play these messages on your PC.

Optionally, you may convert and combine the wav files into a single MP3 file:

3) Go to a wav-to-mp3 site such as this to convert wav files to MP3 files.

4) Go to a MP3-combine site such as this and you'll finally have all your wechat voice messages in one MP3 file.

Sunday, February 19, 2017

A must do for Chinese apps

Yesterday I was in CostCo and my Nexus 6 ran quite warmly. It was the Moli TV doing something in the ground. I opened the Swiss knife - Tasker, added the following profile and task to kill it whenever it is in the background.

New profile, Application, 魔力视频,  link to it a new task:

Code, run shell, am force-stop com.molitv.android.v2, use root.

Now go back to the profile, add to it an exit task, link it to this new task as well and unlink the enter task.



From now on, I can still open this app and use it normally to watch TV, it just won't have a chance to run in the back ground.

I did the same for TV Plus. Those are pretty much the only two Chinese apps I use that have no reason to run in the background.

Wednesday, February 1, 2017

Use SHB9850NC for noise cancelling only

In case you want to use the SHB9850NC for noise cancelling only (no music), you can find a junk headphone or buy one from Dollar Tree, cut off the plug and plug it into the Philips. This will disable Bluetooth and keep the NC active. Use a 3-pole (not 4-pole) plug.


Tuesday, January 24, 2017

Make Philips SHB8750NC Comfortable

These Philips Bluetooth Noise Cancelling headphones are on clearance in Walmart stores for $10-30.  They sound good without exaggerated bass. There is only one issue though: too tight (too much clamping force). We can easily address this issue with nothing but some water.



You can find these headphones with this link (SKU 54383955).

If you want more NC and/or over-the-ear type, then consider the Philips SHB9850NC.

Wednesday, January 18, 2017

FireFox and save passwords, always

First thing first is to install the addon of Saved Password Editor, then most of the web sites will allow you to save passwords, automatically or manually:


But some web developers figured out a trick to confuse FireFox by adding fake "user" and/or "password" input fields around the real one(s). Such fake input fields can be revealed by Inspect Element, like these four fake inputs below the real one:

These four fake input fields must be removed for password-save to work. We need to install Greasemonkey, then add the following user script:

// ==UserScript==
// @name        Enable Password Saving
// @include     https://the_web_site
// @grant       GM_getValue
// ==/UserScript==

var oldInput = document.querySelector ("input[value=no-ff-pwmgr-1]");
oldInput.parentNode.removeChild(oldInput);
oldInput = document.querySelector ("input[value=no-ff-pwmgr-2]");
oldInput.parentNode.removeChild(oldInput);
oldInput = document.querySelector ("input[value=no-ff-pwmgr-3]");
oldInput.parentNode.removeChild(oldInput);
oldInput = document.querySelector ("input[value=no-ff-pwmgr-4]");
oldInput.parentNode.removeChild(oldInput);


Now refresh the page, the four fake input fields are removed:


Log in again and FireFox will prompt us to save the password.