Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rewrite OWA Links to direct URL
// ==UserScript==
// @name OWA Direct Links
// @version 0.1.0
// @description Rewrite OWA Links to direct URL
// @author Gavin Lloyd <gavinhungry@gmail.com>
// @match https://webmail.example.tld/*
// @require https://cdn.jsdelivr.net/jquery/2/jquery.min.js
// @grant none
// ==/UserScript==
jQuery.noConflict();
(function($) {
'use strict';
var rewrite = function() {
var $links = $('a[href^="redir.aspx?"]');
console.log('Rewriting %s links', $links.length);
$links.each(function() {
var $a = $(this);
var href = unescape($a.attr('href').replace(/.*&URL=([^&]*).*/, '$1'));
$a.attr('href', href);
});
};
// go nuts
setInterval(rewrite, 1000);
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.