Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( document.location.hostname.match(/linux\.org\.ru$/) ) {
- // DOMContentReady ???
- var table = $(".message-table");
- if (table && table.length) {
- injectStyle();
- var list = $("<ul>").addClass("message-list");
- list.css({
- "margin": "0",
- "padding": "0",
- "list-style": "none",
- });
- var rows = table.find("tr");
- for (var i=0+1; i<rows.length; i++) {
- var cells = $(rows[i]).children();
- if (cells.length == 4) { // трекер
- var category = cells.eq(0).html();
- var title = cells.eq(1).html();
- var time = cells.eq(2).html();
- var numbers = cells.eq(3).html();
- }
- else if (cells.length == 3) { // форум
- var category = null;
- var title = cells.eq(0).html();
- var time = cells.eq(1).html();
- var numbers = cells.eq(2).html();
- }
- else
- break;
- list.append(formatItem( category, title, time, numbers ));
- };
- table.replaceWith(list);
- list.on("click", "li", function() {
- $(this).find("a").get(0).click();
- });
- function formatItem(category, title, time, numbers) {
- var e = $("<li>");
- e.append(title)
- .append("<br>")
- .append( $("<small>").append(" Последнее: ").append(time).append(" Всего ответов: ").append(numbers) );
- e.find("a").eq(0).css("font-weight", "bold"); // название топика
- return e;
- };
- function injectStyle() {
- var style = $("<style>");
- // в тч костыли для просранной семантики в цсс лора, для танго
- style.text("\
- .message-list li {\
- margin: 0!important;\
- padding: 5px;\
- border-bottom: 1px solid #555753;\
- }\
- \
- .message-list li:hover {\
- background: #5c3566;\
- }\
- \
- .message-list a {\
- color: #eeeeec;\
- text-decoration: none;\
- }\
- \
- .message-list a:visited {\
- #babdb6;\
- }\
- \
- .tag {\
- border-radius: 3px;\
- font-size: 0.8em;\
- padding: 2px 4px;\
- background-color: #555753;\
- font-weight: normal;\
- }");
- $("head").append(style);
- }
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement