JavaScript generate an result array from XPATH

This is a function in JavaScript that use an XPATH string to generate an Array from the results.This is very useful if you have to manipulate or use some items on a page and don’t have the id(like bots).

That is the function:

You could use it in the Terminal:

And we get all hrefs on this page in the Terminal:

Use it to store it in an Array and then write it on the page:

and we got this result:

JavaScript string contains

This is a simple function in JavaScript, I use it to check if a string contains another string.The different in this function is that the return value is the position+1.So you could use it in an If without to check the return value manually, just see my test from 1 to 3.

This is the function:

Now we make a little test to see if it work:

Seems good:

JavaScript element exists

This is a JavaScript Function to check if an element exists, I use it regularly in an If.

The function:

The test:

Our result:

We could see it works as it should.

JavaScript location

In this article I wrote about the location object in JavaScript and what are the different between them.

Host

This two prints the host name, the different between them are that only host is with the port number from the host.

as example:

and we get this:

 

Port

If you just want to get the Port you could use this:

as example:

and we get this:

Together with “location.host” and “location.port” you could get “location.hostname”.

 

Protocol

To get the Server protocol you just need this:

as example:

and we get this:

 

Href,Origin and Pathname

To get some other URL information run this:

as example:

and we get this:

Href just returns the URL with the pathname, origin just the URL without the pathname, pathname just the path behind the URL and at least the search parameter returns the parameters behind the “?”.

new Hompage design

I made a new design for my scheinast.software domain, it looks like this:

scheinast-software

I tryed to make the Page as light weight as possible and use less code as possible

 

Html code:

CSS code:

Background image:

scheinast software background

Submit iframe from main window

I had the problem to submit my form in a iframe with a button on the main page, I used XPATH to get my iframe and then select it and submit the form like this:

WordPress change login image

This is more fun than real use, I want Gandalf from Lord of the Rings to protect my word press login.Its really simple, just upload the images to your web space and then open the “/wp-login.php” and change the this:

to this:

 

and now I want another error image, for this find this part:

then add my line:

 

for a bigger view I changed the “/wp-admin/css/login.min.css”:

 

and now its looks pretty like this:

gandalf1And the error screen:

gandalf2

I hope you like it!

For a live preview look at http://scheinast.eu/wp-login.php.