console.log("Hello, World!"); var video = {title:"Massage Rooms ***** Girl ***** Homemade", desc:"", tags:""}; //************************* //#816# var arrAPRkwrds = ["Amateur ***** Real,Real Amateur *****,PornReal,Amateur *****", "Amateur ***** Real,Real Amateur *****,***** Real,AmateurPorn", "Amateur ***** Real,Real Amateur *****,Real *****,Amateur *****"]; var arrStudios = [ [//Brazzers //Kwrds ["Brazzers","Brazzers *****","Brazzer *****","Brazzers Videos","Brazzers ***** Videos","Video Brazzers","Videos Brazzers","Brazzer Videos","Video Brazzer","Videos Brazzer","Brazzer Video","Brazzers Video *****","Brazzer Video *****"] ], [//True Amateurs //Kwrds ["TrueAmateurs","True Amateur Model","TrueAmateurModels","True Amateur","True Amateurs","TrueAmateur","True Amateur Nude","True Amateurs Videos","True Amateurs *****","True Amateur *****","True Amateurs *****","True Amateur ***** Videos","True Amateur ***** Videos"] ], [//Public Agent //Kwrds ["Public Agent","Public Agents *****","Public Agent *****","Public Agent Full Videos","Czech Public Agent","Public Agent ***** Videos","Public Agent Full *****","Public Agent Full Movie","Public Agent ***** Video","Public Agent ***** Tube","Agent Public *****","Public Agent ***** Tube","Public Agent Movies","Fake Public Agent *****","Public Agent Full Episode","Public Agent Tubes"], ["PublicAgent","Public Agent Com","Public Agent Full","Public Agent ***** Videos","PublicAgent Videos","Public Agent New","Public Agent Video","PublicAgent Tube","Public Agent Hd *****","Public Agent ***** For Money","Full Public Agent","Public Agent New *****","Czech Agent *****","Public Agent ***** Movies","PublicAgents"], ["Public Agent *****","PublicAgent Com","Public Agent Full Video","Fake Public Agent","Agent *****","Public Agent Hd","Public Agent Online","Agent ***** Videos","Public Agent ***** Hd","Public Agent ***** Movies","Public Agent Fake","Czech Public Agent *****","PublicAgentSex","Public Agent Channel","Full Public Agent Videos","Public Agent Full Version"] ], [//Fake Taxi //Kwrds ["Fake Taxi","Fake Taxi *****","***** Taxi","Fake Taxi Videos","Fake Taxi ***** Videos","FemaleFakeTaxi","Czech Taxi *****","Fake Taxi New","Fake Taxi Tube","Full Fake Taxi","Fake Taxi New Videos","Fake Taxi Long Videos","Female Fake Taxi"], ["FakeTaxi","Taxi *****","Fake Taxi *****","Fake Taxi Full Videos","Fake Taxi Full","Czech Fake Taxi","Fake Taxi ***** Videos","Fake Female Taxi","Fake Taxi Hd","Female Fake Taxi *****","FakeTaxiPorn","Fake Taxi Full Episodes","Fake Taxi Clips"] ], [//Female Agent //Kwrds ["FemaleAgent","Female Fake Agent","Female Casting Agent","Female Agent *****","Female ***** Videos","Female Casting *****","Female Agent Tube","Fake Female Agent *****","FemaleAgent Hd","Agent Female","FemaleAgent Videos","***** Female Agent","Female Agent Hd *****","Female Agent ***** Hd","Czech Female Agent *****"], ["Female Agent","FemaleAgent Com","Female Agent Casting","Female Agent *****","Female Casting","Czech Female Agent","Female Agent ***** Videos","Female Agent Casting *****","Female Agent Hd","Video Female Agent","Female Agent ***** Tube","Female Agent Fake","New Female Agent","Casting Female *****","Female Public Agent *****"], ["Fake Female Agent","Female Agent Com","FemaleAgent *****","Female Agent Videos","Fake Agent Female","FemaleAgent Tube","Female Agent ***** Videos","***** Female Casting","Fake Agent Female *****","Female Agent Couple","Public Female Agent","Female Agent Casting Videos","Female Agent New","Fake Female Agent Videos","Female Agent ***** Tube"] ], [//Massage Rooms //Kwrds [["Massage Rooms","Massage Room *****"],"Massage Rooms ***** Videos","Massage Room ***** Videos","Massage Rooms Hd","Massage Room Tube","***** Massage Room","Massage Room Hub","Massage Rooms Full","Massage Room Hd *****","Massage Room ***** Video"], [["Massage Room Com","Massage Rooms *****"],"Room Massage","Massage Rooms ***** Videos","Hot Massage Room","Massage Room ***** Video","MassageRoomPorn","Massage ***** Room","Massage RoomSex","Massage Room ***** Hd","Massage Room Clips"], [["MassageRooms"],"Massage Room *****","Massage Room X","Massagem Rooms","The Massage Room","Oil Massage Room","Room Massage *****","Massage Rooms ***** Videos","***** In Massage Room","MassageRoomsXXX"] ] ]; function getElementsRandFromArray (arr, num = 1) { var res = []; var random = -1; for(var i = 0; i < num;){ random = Math.floor(Math.random() * arr.length); if(res.indexOf(arr[random]) !== -1){ continue; }; res.push(arr[random]); i++; }; return res; }; function findTitleSiteKwrd(title, arrStudios) { //Verifica se alguma das kwrds está no titulo do video e se a encontra retorna o id do site e a kwrd que encontrou. var siteFound = {id:-1, kwrd:""}; var kwrdAux = ""; var numKwrdsWords = 0; var arrKwrdsWords; var titleAux = title.trim().toLowerCase(); for(var i = 0; i < arrStudios.length; i++) //Studios { numKwrdsWords = 0; for(var j = 0; j < arrStudios[i].length; j++) //Groups Kwrds { for(var l = 0; l < arrStudios[i][j].length; l++) //Kwrds { kwrdAux = arrStudios[i][j][l].trim().toLowerCase(); arrKwrdsWords = kwrdAux.split(" "); if (titleAux.indexOf(kwrdAux) !== -1) { if (arrKwrdsWords.length > numKwrdsWords) { siteFound.id = i; siteFound.kwrd = arrStudios[i][j][l]; numKwrdsWords = arrKwrdsWords.length; } } } } if (siteFound.id > -1) { break; } } return siteFound; } const numDescKwrdsMax = 5; const APRkwrdsForDesc = 'Real Amateur ***** Real'; var arrDescKwrdsRand = [numDescKwrdsMax]; var descKwrdsRand = ""; var numSiteTagsGroups = 0; var idSiteTagsGroupRand = -1; //var numGroupTags = 0; var idKwrdRand = -1; var kwrdRand = ""; var tagsKwrdsRand = ""; var APRkwrds = ""; //#815# *** var titleAux = video.title.trim().toLowerCase().replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase()))); var descAux = ""; //#/815# *** var numSites = arrStudios.length; var siteFound = findTitleSiteKwrd(titleAux, arrStudios); //Verifica se alguma das kwrds está no titulo do video e se a encontra retorna o id do site e a kwrd que encontrou. if (siteFound.id > -1) { numSiteTagsGroups = arrStudios[siteFound.id].length; idSiteTagsGroupRand = (Math.floor(Math.random() * numSiteTagsGroups)); //Obtem aleatoriam. o id de um dos array de grupos de kwords do site. //numGroupTags = arrStudios[siteFound.id][idSiteTagsGroupRand].length; arrDescKwrdsRand = getElementsRandFromArray (arrStudios[siteFound.id][idSiteTagsGroupRand], numDescKwrdsMax); //Desse array de kwrds do grupo escolhido. obtem aleatoriam. um outro array com numDescKwrdsMax de kwrds para se poderem adicionar à desc do video. idKwrdRand = (Math.floor(Math.random() * arrDescKwrdsRand.length)); //Desse array de kwrds escolhidas escolhe aleatoriam. uma delas para ser colocada no inicio do do titulo do video e tb como a ultima tag de modo a vir a ser a keyword de referencia do video no pliugin Yoast SEO do wp. kwrdRand = arrDescKwrdsRand[idKwrdRand]; //Idem arrDescKwrdsRand.splice(idKwrdRand, 1); //Do array de kwrds a colocar na desc do video retira-se essa mesma kword para ao ser colocada no inicio do titulo do video e como este é usado para criar a desc do mesmo, essa kwrd não aparecer repetida na desc. for(var i = 0; i < arrStudios[siteFound.id][idSiteTagsGroupRand].length; i++) { //Retirar tb essa kwrd do seu respectivo grupo de kwrds de forma a que essa kwrd possa depois ser adicionada como a última tag do video. if (arrStudios[siteFound.id][idSiteTagsGroupRand][i].trim().toLowerCase() === kwrdRand.trim().toLowerCase()) //Kwrd procurada e encontrada no seu respectivo grupo de kwrds. { arrStudios[siteFound.id][idSiteTagsGroupRand].splice(i, 1); //Kwrd retirada do seu respectivo grupo de kwrds. break; } } tagsKwrdsRand = arrStudios[siteFound.id][idSiteTagsGroupRand].join(',')+','+kwrdRand; //Ggrupo de kwrds seleccionadas formatadas como ',' como tags e adicionada a kwrd do titulo como a última tag do video. descKwrdsRand = arrDescKwrdsRand.join(' '); //O grupo de kwrds selecionados par aa desc do video são formatadas com ' '. descKwrdsRand = descKwrdsRand.split(" ").filter(function(value,index,arr){ return value !== arr[index+1];}).join(" "); //Removem-se da desc do video quaisquer palavras consecutivas que possa ter. titleAux = titleAux.replace(siteFound.kwrd,kwrdRand); //Do titulo do video substitui-se a kwrd que tinha sido encontrada par as eidentificar o site pela nova kwrd que havia sido escolhida aleatoriamente. titleAux = titleAux.split(" ").filter(function(value,index,arr){ return value !== arr[index+1];}).join(" "); //Removem-se do titulo do video quaisquer palavras consecutivas que possa ter. descAux = titleAux+' '+descKwrdsRand; //Compoem-se a desc do video adicionando ao titulo as kwrds aleatoriamente escolhidas antes. descAux = descAux.split(" ").filter(function(value,index,arr){ return value !== arr[index+1];}).join(" "); //Removem-se da desc do video quaisquer palavras consecutivas que possa ter. } video.title = titleAux+((descAux.trim() === '') ? ' Part2' : ''); //Aos videos que não sejam de studio adiciona-se a palavra "Part2". video.desc = (descAux.trim() === '') ? video.title : descAux; //Aos videos que não sejam de studio não foi criada a desc antes, logo tem que ser criada aqui. video.desc = video.desc+' '+APRkwrdsForDesc; //Adiciona-se à desc as keywords próprias que o site APR mais aposta em rankear no Google. //Escolhe-se aleatoriamente um dos grupos de keywords próprias em que o site APR mais aposta em rankear no Google e formatam-se para serem adicionadas à lista de tags do video, e por ultimo adiciona-se a tagsKwrdsRand que tem sempre que se garantir ser a última tag da lista. APRkwrds = arrAPRkwrds[(Math.floor(Math.random() * arrAPRkwrds.length))]; video.tags = video.tags+((video.tags != '') ? ',' : '')+APRkwrds+((tagsKwrdsRand != '') ? ','+tagsKwrdsRand : ''); //#/816# //console.log(video); //alert(video); document.write(video);
Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast. The editor shows sample boilerplate code when you choose language as Javascript and start coding.
Javascript(JS) is a object-oriented programming language which adhere to ECMA Script Standards. Javascript is required to design the behaviour of the web pages.
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', function(line){
console.log("Hello, " + line);
});
Keyword | Description | Scope |
---|---|---|
var | Var is used to declare variables(old way of declaring variables) | Function or global scope |
let | let is also used to declare variables(new way) | Global or block Scope |
const | const is used to declare const values. Once the value is assigned, it can not be modified | Global or block Scope |
let greetings = `Hello ${name}`
const msg = `
hello
world!
`
An array is a collection of items or values.
let arrayName = [value1, value2,..etc];
// or
let arrayName = new Array("value1","value2",..etc);
let mobiles = ["iPhone", "Samsung", "Pixel"];
// accessing an array
console.log(mobiles[0]);
// changing an array element
mobiles[3] = "Nokia";
Arrow Functions helps developers to write code in concise way, it’s introduced in ES6.
Arrow functions can be written in multiple ways. Below are couple of ways to use arrow function but it can be written in many other ways as well.
() => expression
const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
const squaresOfEvenNumbers = numbers.filter(ele => ele % 2 == 0)
.map(ele => ele ** 2);
console.log(squaresOfEvenNumbers);
let [firstName, lastName] = ['Foo', 'Bar']
let {firstName, lastName} = {
firstName: 'Foo',
lastName: 'Bar'
}
const {
title,
firstName,
lastName,
...rest
} = record;
//Object spread
const post = {
...options,
type: "new"
}
//array spread
const users = [
...adminUsers,
...normalUsers
]
function greetings({ name = 'Foo' } = {}) { //Defaulting name to Foo
console.log(`Hello ${name}!`);
}
greet() // Hello Foo
greet({ name: 'Bar' }) // Hi Bar
IF is used to execute a block of code based on a condition.
if(condition){
// code
}
Else part is used to execute the block of code when the condition fails.
if(condition){
// code
} else {
// code
}
Switch is used to replace nested If-Else statements.
switch(condition){
case 'value1' :
//code
[break;]
case 'value2' :
//code
[break;]
.......
default :
//code
[break;]
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while (condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
ES6 introduced classes along with OOPS concepts in JS. Class is similar to a function which you can think like kind of template which will get called when ever you initialize class.
class className {
constructor() { ... } //Mandatory Class method
method1() { ... }
method2() { ... }
...
}
class Mobile {
constructor(model) {
this.name = model;
}
}
mbl = new Mobile("iPhone");