Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name GroupEight#2
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description HIS
- // @author You
- // @match http://groupeight.tk:8888/install-master/backend/rainlab/blog/posts/*
- // @require https://raw.githack.com/a97marbr/ContextFreeLib/master/js/contextfreegrammar.js
- // @require https://raw.githack.com/a97marbr/ContextFreeLib/master/js/randapp.js
- // @grant none
- // ==/UserScript==
- var seed = 15;
- var sentence = '';
- var slug = document.getElementById('Form-field-Post-slug');
- var grammar = new ContextFreeGrammar({
- "probabilityNounPhrase":0.5,
- "probabilityVerbPhrase":0.5,
- "probabilityDualAdjectives":0.5,
- "probabilityStartAdjective":0.5,
- "distributionOfNouns":"normal",
- "distributionOfVerbs":"normal",
- "distributionOfAdjectives":"normal",
- "distributionOfAdverbs":"normal",
- "distributionOfDeterminers":"normal",
- "distributionOfConjunctions":"normal",
- "distributionOfModals":"normal",
- "randomSeed":seed
- });
- function run(){
- // Fill Post
- setTimeout(function(){
- getSentencesTitle();
- makeid(6);
- getSentencesText();
- }, 300);
- // Save Post
- setTimeout(function(){
- document.querySelector('.oc-icon-check').click();
- }, 500);
- // Close Tab
- setTimeout(function(){
- window.close();
- }, 800);
- }
- // Create title for the blogpost
- function getSentencesTitle(){
- for(var i = 0;i < 1; i++)
- {
- sentence=grammar.generateSentence();
- document.getElementById('Form-field-Post-title').value+=sentence;
- }
- }
- // Create sentences for the blogpost
- function getSentencesText(){
- for(var i = 0; i < 10; i++)
- {
- sentence+=grammar.generateSentence();
- }
- CKEDITOR.instances['Editor-formContent-textarea-content'].setData(sentence);
- }
- // Create blogpost "id"
- function makeid(length) {
- var result = '';
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- var charactersLength = characters.length;
- for (var i = 0; i < length; i++) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- slug.value = result;
- }
- // Run the creation of a blogpost.
- run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement