Skip to content

Instantly share code, notes, and snippets.

@shtrih
Last active December 17, 2015 11:49
Show Gist options
  • Save shtrih/5604907 to your computer and use it in GitHub Desktop.
Save shtrih/5604907 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Logs link grabber
// @namespace https://gist.github.com/shtrih/5604907
// @version 0.3
// @description enter something useful
// @match http://old.4otaku.org/logs*
// @copyright 2013+, shtrih
// ==/UserScript==
function scriptBody() {
var container = $('<div/>', {
css: {
'border-radius': '15px',
'background': '#fff',
'z-index': '102',
'border': '4px solid #525252',
'box-shadow': '1px 1px 9px #999',
'padding': '10px',
'width': '50%',
'margin-left': '25%',
'position': 'absolute',
'text-align': 'left',
'display': 'none'
}
});
container.append(
'<ol>'
+ $('#logs a').map(function () {
var href = $(this).attr('href');
return (/http/).test(href) ? '<li><a href="' + href + '" target="_blank">' + href + '</a></li>' : null;
}).get().join('')
+ '</ol>'
);
$('.search_logs_button')
.after(
$('<input/>', {
value: 'Ссылки в логах',
click: function () {
container.fadeToggle('fast');
}
})
)
.after(container);
}
var script = document.createElement('script');
script.textContent = '(' + scriptBody.toString() + ')()';
(document.head||document.documentElement).appendChild(script);
script.parentNode.removeChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment