NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Kirara News API Nice Formatting // @namespace https://openuserjs.org/users/Alive6ftUnder // @updateURL https://openuserjs.org/meta/Alive6ftUnder/Kirara_News_API_Nice_Formatting.meta.js // @version 0.1 // @description What it says on the tin // @author Youko // @copyright 2018, Alive6ftUnder (https://openuserjs.org/users/Alive6ftUnder) // @license MIT // @match https://krr-prd-web.star-api.com/news/ // @match https://krr-prd-web.star-api.com/news/page/* // @grant none // @run-at document-end // ==/UserScript== (function() { 'use strict'; if (/\d{4,}/.test(window.location.href)) { var style = document.createElement('style'); style.innerHTML = "div.newsType { display: inline-block; }" + "div.newsType.back {" + "float: right;" + "background-image: url(https://i.imgur.com/gAfsBD7.png);" + "cursor: pointer;" + "}"; document.querySelector('head').appendChild(style); var backButton = document.createElement('div'); backButton.classList.add("newsType"); backButton.classList.add("back"); backButton.onclick = function() { window.open("https://krr-prd-web.star-api.com/news/","_self") }; var nh = document.querySelector('.newsHeader'); nh.insertBefore(backButton, nh.children[1]); } else { var styleSheet = document.createElement('link'); styleSheet.setAttribute('rel', 'stylesheet'); styleSheet.setAttribute('id', 'star-news_detail-style-css'); styleSheet.href = "https://krr-prd-web.star-api.com/wp-content/themes/star/assets/css/news_detail.css?ver=2017122705"; styleSheet.setAttribute('type', 'text/css'); styleSheet.setAttribute('media', 'all'); document.querySelector('head').appendChild(styleSheet); var style = document.createElement('style'); style.innerHTML = ".newsDetail .newsInner { margin: 40px auto 40px auto}"+ ".newsPost.translated { filter: brightness(1.1); }"+ ".page-numbers li { display: inline; }"+ ".page-numbers {"+ "width: fit-content;"+ "margin: 12px auto 0px auto;"+ "font-size: 30px;"+ "}"+ ".page-numbers li {"+ "margin: 0px 8px;"+ "}"+ ".page-numbers .prev { font-size: 0; }"+ ".page-numbers .prev::after {"+ "font-size: 30px;"+ "content: 'prev';"+ "}"+ ".page-numbers .next { font-size: 0; }"+ ".page-numbers .next::after {"+ "font-size: 30px;"+ "content: 'next';"+ "}"; document.querySelector('head').appendChild(style); document.querySelector('.newsTop').classList.add('newsDetail'); var range = new Range(); range.selectNode(document.querySelector('.newsList')); var mod = document.createElement('div'); mod.classList.add('newsInner'); range.surroundContents(mod); var posts = document.querySelectorAll('.newsPost'); for (var i = 0; i < posts.length; i++) { range.selectNodeContents(posts[i]); mod = document.createElement('div'); mod.classList.add('newsTitle'); range.surroundContents(mod); } } })();