DIR Return Create A Forum - Home
---------------------------------------------------------
BotBitsand Nix
HTML https://botsbitsandnix.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: javascript
*****************************************************
#Post#: 8--------------------------------------------------
My random junk
By: Nixsy Date: June 3, 2020, 2:17 pm
---------------------------------------------------------
Quote script
[code]randomQuote();
function randomQuote() {
var request = require('request');
var quoteurl =
"
HTML http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=jsonp&lang=en&jsonp=?";
request({
url: quoteurl,
json: true
}, function(err, res, json) {
if (err) {
throw err;
}
json = json.substr(2);
json = json.slice(0, -1);
var junk = JSON.parse(json);
console.log(junk.quoteText)
});
}[/code]
#Post#: 9--------------------------------------------------
Re: My random junk
By: Nixsy Date: June 3, 2020, 3:03 pm
---------------------------------------------------------
same thing slightly different
[code](function()
{
var TEXT = 'i like frogs ';
Array.prototype.slice.call(
document
.querySelectorAll(
'input[type=text],textarea'
)).map(function(
el)
{
el.onkeypress =
function(evt)
{
var charCode =
typeof evt
.which ==
"number" ?
evt
.which :
evt
.keyCode;
if (charCode &&
charCode >
31)
{
var start =
this
.selectionStart,
end =
this
.selectionEnd;
this.value =
this
.value
.slice(
0,
start
) +
TEXT[
start %
TEXT
.length
] +
this
.value
.slice(
end
);
this.selectionStart =
this
.selectionEnd =
start +
1;
}
return false;
}
});
}());[/code]
*****************************************************