NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name ROS Webb- Source Code Styling // @namespace http://tampermonkey.net/ // @version 1.0.3 // @author salience // @copyright 2021, salience (https://openuserjs.org/users/salience) // @license MIT // @match *http://sedvms1.otsrv.mtrltech.com/syntax_parse/development/* // @require https://code.jquery.com/jquery-3.5.1.slim.min.js // @grant none // ==/UserScript== $(function() { var title = $('title'); var titleArr = title.html().split('/'); title.html(titleArr[titleArr.length - 1]); var content = $('pre'); // Get main code content of page var path = (window.location.pathname).replace('/syntax_parse/development/ros_new/', ''); var pathContainer = '<div style="position:fixed; right: 4px; top: 0; font-family: monospace; font-size: 2.25em; font-weight: bold;">' + path + '</div>'; if (content.length !== 0) { // Insert path/filename box content.after(pathContainer); // Show letter å/Å var contentProcessed = content.html().replace(/ĺ/g, 'å').replace(/Ĺ/g, 'Å'); content.html(contentProcessed); // Process content and insert line numbers var lineNumberContainer = $('<span style="border-right:1px solid; float:left; margin:0 2em 0 -1em; text-align:right;"></span>'); var numberOfLines = content.html().split(/\n/).length; for (var j = 0; j < numberOfLines; j++) { lineNumberContainer.append('<span class="line-number">' + (j + 1) + '</span>'); } content.prepend(lineNumberContainer); content.append('<span style="display:block; clear:both;"></span>'); $('.line-number').css({ 'display': 'block', 'padding': '0 .5em 0 1em', 'color': 'gray' }); } });