Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Generate Post
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match http://www.grupp4.tk:8888/install-master/backend/rainlab/blog/posts/create
- // @grant none
- // @require https://raw.githack.com/a97marbr/ContextFreeLib/master/js/contextfreegrammar.js
- // @require https://raw.githack.com/a97marbr/ContextFreeLib/master/js/randapp.js
- // ==/UserScript==
- (function() {
- 'use strict';
- // Your code here...
- var seed = 89024396;
- var counter = 0;
- var titlesentence;
- var sentence;
- var numPost = 20;
- 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 getSentencies(){
- sentence=grammar.generateSentence();
- for(var i = 0; i < 20; i++){
- sentence=sentence+grammar.generateSentence();
- }
- }
- function getTitleSentencies(){
- titlesentence=grammar.generateSentence();
- }
- while (counter < numPost) {
- getTitleSentencies();
- getSentencies();
- document.getElementById("Form-field-Post-title").value = titlesentence + counter;
- document.getElementById("Form-field-Post-slug").value = "Borje-Lundin" + counter;
- getSentencies();
- CKEDITOR.instances["Editor-formContent-textarea-content"].setData(sentence);
- document.getElementsByClassName('btn btn-primary oc-icon-check save')[0].click()
- counter++;
- window.location.href = 'http://www.grupp4.tk:8888/install-master/backend/rainlab/blog/posts/create';
- }
- localStorage.clear();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement