I don’t get what you want to achieve here? why do you create a class as your first steps? Maybe your are biting off too big chunks to swallow?
Why don’t you first try to follow the tutorial you linked to, to have one page that shows your alert?
Maybe then you should try to combine your extension with classes.
If you try to include your extension in your class you want to add the reference to your extension in the sheet, so that instances of your class execute the code. Then you need to create an instance…
Walk slowly, step by step, xwiki is a too powerful tool to manage it in one go. At least this is my experience.
The XWiki page I’m using is the Home or landing page that shows up when you first create the XWiki. I did also attempt dropping this code into the XWiki editor (I saw that the link in the navbar read Main/WebHome) :
I just created a page called SkinExt, created the javascript object and adjusted the settings as per the tutorial, and dropped this code in the XWiki editor:
I changed the setting for ‘use this extension’ to ‘On this Page or on demand’ instead of ‘on demand’ like the tutorial, and the message popped up right as the page loaded.