NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name ReportBox // @namespace http://tampermonkey.net/ // @version 1.2 // @description Позволяет открывать отчеты в модальном окне // @updateURL https://openuserjs.org/meta/KorDen/ReportBox.meta.js // @author KorDen // @match https://vk.com/* // @license MIT // @copyright 2018, KorDen (vk.com/kordenz) // @require http://code.jquery.com/jquery-1.12.4.min.js // @grant none // ==/UserScript== window.addEventListener('load', function () { if (location.pathname == '/away.php') return; if (location.host !== 'vk.com') return; if (location.pathname == '/notifier.php') return; var script = document.createElement('script'); script.appendChild(document.createTextNode('(' + init + ')();')); (document.body).appendChild(script); document.head.appendChild(ce('style', { innerHTML: '#bt_box_report #bt_report_one_block{box-shadow:none;}'+ '#bt_box_report #bt_report_one_section{box-shadow:none;}' })); }); function init() { var navgo = nav.go; nav.go = function (loc, ev, opts) { if (!loc) return navgo(loc, ev, opts); var loc2 = loc; loc = typeof loc == "object" ? loc.href : loc; if (location.href.indexOf(loc)==-1) { if (loc && loc.indexOf("/bugtracker?act=show&id=") != -1) return reportBox(loc); else return navgo(loc2, ev, opts); }else return navgo(loc2, ev, opts); }; $('body').on('click', 'a[href*="bugtracker"]', function(e){ var rh = e.target.href; if (rh && rh.indexOf("/bugtracker?act=show&id=") != -1) return reportBox(rh); else if (rh && decodeURIComponent(rh).indexOf("/bugtracker?act=show&id=") != -1) return reportBox(decodeURIComponent(rh)); }) function reportBox(id) { id = idFromHref(id); ajax.post("al_bugtracker.php?__query=bugtracker&_ref=bugtracker&act=show&al=1&al_id=" + vk.id + "&id=" + id, {}, { onDone: function (r1, r2, r3) { stManager.add(['al/bugtracker.js']); var d = document.createElement("div"); var content; d.innerHTML = r2; if (d.querySelector("#wide_column").querySelector(".page_block").id!="bt_report_one_block") d.querySelector("#wide_column").removeChild(d.querySelector("#wide_column").querySelector(".page_block")); var prev = ge("bugreport" + id) && ge("bugreport" + id).previousSibling ? ge("bugreport" + id).previousSibling.querySelector('.bt_report_title_link').href : ''; var next = ge("bugreport" + id) && ge("bugreport" + id).nextSibling ? ge("bugreport" + id).nextSibling.querySelector('.bt_report_title_link').href : ''; prev = prev ? '<div id="bt_box_report_prev" class="fl_l"><a href="' + prev + '">Предыдущий</a></div>' : ''; next = next ? '<div id="bt_box_report_next" class="fl_r"><a href="' + next + '">Следующий</a></div>' : ''; content = '<div id="bt_box_report">' + prev + next + '<div class="clear_fix"></div>' + d.querySelector("#wide_column").innerHTML + '</div>'; if (!curBox()) { var box = new MessageBox({ width: 800 }); box.content(content); box.show(); } else if (curBox() && curBox().bodyNode.querySelector('#bt_box_report')) { curBox().bodyNode.innerHTML = content; } eval(r3); }, onFail: function (r) { showFastBox('Ошибка', r); } }); return false; } function idFromHref(h) { return parseInt(h.split('/bugtracker?act=show&id=')[1]); } }