Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Qt Blog Template
- // @namespace http://qt.io/
- // @version 0.1
- // @description この記事は〜を翻訳したものです。
- // @author Tasuku Suzuki
- // @match https://blog.qt.io/blog/*/*/*/*/
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var title = $('h2.entry-title').text();
- var url = location.href;
- var author = $('div.author-avatar').next().children('a');
- var name = author.text();
- var link = author.attr('href');
- var date = '';
- if (/\/(20[0-9]{2})\/([0-9]{2})\/([0-9]{2})\//.test(location.pathname))
- date = RegExp.$1 + '年' + RegExp.$2 + '月' + RegExp.$3 + '日';
- var text = 'この記事は <a href="https://blog.qt.io/">The Qt Blog</a> の <a href="' + url + '">' + title + '</a> を翻訳したものです。\n';
- text += '執筆: <a href="' + link + '">' + name + '</a>, ' + date;
- $('h2.entry-title').before('<textarea rows="5" cols="80">' + text + '</textarea>');
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement