Greasemonkey: Fix links to PDFs in Bank Hapoalim

This fixes both the links to the PDFs and the embeding in the mailbox. Click on the “View Raw” to install.


// ==UserScript==
// @name Bank Hapoalim
// @description Workaround bugs in Bank Hapoalim website to display pdf messages.
// @author Guy Rutenberg
// @namespace http://www.guyrutenberg.com
// @include https://login.bankhapoalim.co.il/portalserver/mailInbox#/folders/0
// @include https://login.bankhapoalim.co.il/ng1-portals/rb/he/mails#/folders/0
// @run-at document-idle
// @version 1.1
// @grant none
// ==/UserScript==
//
// @include url should be the url of the inner iframe containing the list of mails.
var MutationObserver = window.MutationObserver;
var myObserver = new MutationObserver (mutationHandler);
var obsConfig = {
childList: true, attributes: false,
subtree: true,
};
var target = document.getElementsByTagName('mail-manager')[0];
myObserver.observe (target, obsConfig);
function mutationHandler (mutationRecords) {
console.log('here');
mutationRecords.forEach ( function (mutation) {
for (var item of mutation.addedNodes) {
if (item.tagName == 'PDF-VIEWER') {
var url = 'https://login.bankhapoalim.co.il' + item.getAttribute('pdf-show');
iframe = item.querySelector('iframe');
iframe.src = url;
}
}
});
}

Outbrained – Greasemonkey script to remove tracking Outbrain links

Outbrain is a service that provides related content links to publishers. It is used by some news sites I frequent and recently I’ve been annoyed by its tracking behavior. When you hover with your cursor above the link it seems like a regular benign link but once you click on the link, it changes to an evil tracking URL. To add to the annoyance, it is not always easy to distinguish Outbrain “ads” from legitimate links on first sight.

To end this annoyance for me, I’ve written a little Greasemonkey script. It currently setup to work for Haaretz, Ynet, Calcalist and TheMarker but it should work fine for any site using Outbrain if enabled.

Download: outbrained.user.js


// ==UserScript==
// @name Outbrained
// @namespace http://www.guyrutenberg.com
// @description Removes annoying tracking outbrain links.
// @include http://www.haaretz.co.il/*
// @include http://www.ynet.co.il/*
// @include http://www.calcalist.co.il/*
// @include http://www.themarker.com/*
// @version 1.0
// @grant none
// ==/UserScript==
// Change Log
// ==========
// 1.0: 2014-08-01
// * Initial release.
function isOutbrainLink(element) {
var onmousedown_attr = element.getAttribute('onmousedown');
return /^this\.href='http:\/\/[^.]+\.outbrain\.com/.test(onmousedown_attr);
}
function fixLink(element, index, array) {
element.removeAttribute('onmousedown');
element.removeAttribute('onclick');
}
var all_links = document.getElementsByTagName('a');
for (var i = 0; i < all_links.length; i++) {
var link = all_links[i];
if (!isOutbrainLink(link))
continue;
fixLink(link);
}

Haaretz Premium Bypass Userscript POC

Haaretz site became paywalled a couple of months ago, allowing reading 10 “premium” articles before requiring payment. After a friend recommended their app for smartphones, which unlike the site is free, I started reading it mainly on my phone. Few days ago I had no internet connection on my phone, and instead of seeing an article I saw an error page saying it’s not reachable (the usual android’s built-in browser type). The url was something like http://www.haaretz.co.il/misc/smartphone-article/.premium-1.2070500, while the url for the same article in the regular site is http://www.haaretz.co.il/news/world/middle-east/.premium-1.2070500. This of course got me curious and a quick check showed that there is no problem accessing the mobile version from a desktop browser. So I went a head and wrote a simple proof-of-concept Greasemonkey script to demonstrate replacing missing premium content in the desktop site by content intended for the smartphone app.
Continue reading Haaretz Premium Bypass Userscript POC

A Greasemonkey Fix to the Top Menu in Sheilta (Open University)

Following comments in Fixing the Home Link in the Telem System (Open U) I’ve decided to fix the top bar links in the Sheilta system too.

The links in the top bar are javascript links that open in a new window when clicked. My Greasemonkey script turns them into regular links that you can open in a new tab.

Continue reading A Greasemonkey Fix to the Top Menu in Sheilta (Open University)

Fixing the Home Link in the Telem System (OpenU)

This post can be helpful for students of the Open University of Israel. As a student there, I found it very annoying that the link to the courses’ homepage in the Telem system is a JavaScript link. This prevents it from opening in a new tab, and thus require various workarounds to get back to the homepage in a different tab. So, a little while ago I wrote a little Greasemonkey script to fix it.

// telem.user.js
// version 0.1 
// 2008-01-01
// Copyright (c) 2008, Guy Rutenberg
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// ==UserScript==
// @name          OpenU's Telem - Fix Home Button
// @namespace     http://www.guyrutenberg.org/
// @description   Fixes the home button link in the telem system of the OpenU.
// @include       http://maagar.openu.ac.il/opus/*
// ==/UserScript==


home = document.getElementById('home');
if (home) {
	re = /javascript:find_home_page\('(.*?)','(.*?)',/
	match = re.exec(home.href)
	home.href = 'http://telem.openu.ac.il/courses/'+match[2]+'/'+match[1]
}

This script changes the link to a regular non-JavaScript link. I’ve tested it for more than a month now, without finding any bugs. However if you find something, or have any suggestion, please comment.

Update: See A Greasemonkey Fix to the Top Menu in Sheilta (Open University), it has a fix for the top menu bar in the Sheilta system