Jump to content
xisto Community


  • Content Count

  • Joined

  • Last visited

  1. My New Year's Resolution is both realistic and I've stuck to it so far! Sure, that's only two days, but I'm working on making it into a habit. Basically, every so often I go through a spell of doing a bit of exercise each morning to work off a few pounds or tone up a bit. Nothing much, maybe ten pressups and twenty situps. Easy enough to do, and certainly not time consuming. For some reason, most likely forgetfullness or being a bit rushed as I wake up late for work or whatever, I never tend to keep up this routine for longer than a few weeks. Well...here comes attempt number sixty seven (or something like that). I figure if I make it a New Year's resolution then I should find it a bit easier to stick to, whether that be because I remember it more easily or due to wanting to say that I've suceeded. Conversations can go along the lines of: "So what's your New Year resolution?" "Oh, I'm doing a bit of exercise every day. Managed a month of it now!" As opposed to: "So what's your New Year's resolution?" "Well...it was to do a bit of exercise every day, but I kind of caved in after a week..." Nothing like avoiding an awkward or embarassing conversation that could happen as motivation to keep up with the exercise! As a side note: yes, I know it's quite possibly one of the most overused resolutions out there (or variations of it, like "lose weight", "build up some muscle" or whatever), but I personally reckon that making it much simpler than some arbitary goal (e.g. "lose X pounds") which has no time limit or regularity then you've got no real inspiration or motivation to do it. Keeping it short, simple and regular is not only making it more likely that I'll actually do it, but is quite probably a heck of a lot better for my body than "binge exercise".
  2. As a bit of a follow up question, I'm now working on trying to use the "unload" event. Again referring to this page, the code it suggests is something like this: Using the code above, I also get a strange number of alerts. When opening a new tab it says "page unloaded:about:blank", and nothing when I close it. Surely it should be the other way around? It also triggers a second popup when closing iframes and the like. My immediate response to this is to try to find a way to attach it to the tab in question, rather than the window as a whole. I'm currently storing a bit of information about each open tab that's from a particular domain in objects within my extension (myExtension.pages.page is a class, referred to by using myExtension.pages.objIdArray[#]). Each page object has a variable called doc which stores (I believe?) a reference to the tab it's open in, or at least something very similar. I'm using the code in my above post, so if it doesn't do that then I'd love to know. Anyway, I was thinking that I could add an event to the closing of the tabs that are on this particular URL (close, refresh, back, however it's closed doesn't overly matter to me. The important thing is that you're leaving the page) by doing something along the lines of "this.doc.addEventListener ( "pagehide", myExtension.pages.destroy(this), false );" within the page class and dealing with it within myExtension.pages.destroy (on the basis that I could work backwards to find out how to update my array and so on, the important thing is that I can trigger a function in a manner similar to this). Unfortunately, this doesn't seem to work all that well (i.e. it doesn't). One option I've considered is to use the code example shown above and doing some sort of checking within it to work out if the page closed was one of the ones I'm tracking, but it doesn't seem all that elegant. Any suggestions for this one?
  3. Hey again folks, once more I turn to you people for JavaScript-y help. So, I'm working on a Firefox extension and am using the AddEventListener method to work out when a new page has been loaded. If it's a particular URL then I do some stuff to it (preferably before it's shown to the user, but I gather that that may not be possible), I've got it semi-working, however there's some funky behaviour that I don't understand. With some severe "snipping", my code is as follows: var myExtension = new function (){ this.init = function () { /* initialise page load listener */ var appcontent = document.getElementById ("appcontent"); if ( appcontent ) { appcontent.addEventListener ( "load", myExtension.onPageLoad, true ); } }; this.onPageLoad = function ( aEvent ) { var doc = aEvent.originalTarget; alert ( "Test!" ); };}/* initialise window listener */window.addEventListener ( "load", function () { myExtension.init(); }, false );This is pretty much taken pretty much exactly from here. The one real change I made is changing the "DOMContentLoaded" event type to "load", as it made more sense to me at the time. I've got two real questions for you: firstly, why can't the external listener ("window.addEventListener(...)") point directly to the myExtension.onPageLoad function? I assume that it's something to do with what object triggers the event, and therefore how to access the "originalTarget" bit within onPageLoad, but a bit of an explanation would be grand. Secondly, what's the difference between "load" and "DOMContentLoaded"? Based on this page, it gives a pretty good explanation of what the difference is, so that's great. My main issue here is that, when using "load" and opening a typical page (e.g. Google) I get 4 alerts saying "Test!" when it's loaded. I even get 3 for opening a new tab! It's not a problem so much as a confusion. Why does opening a new tab trigger the "load" event three or four (or even more!) times, and the DOMContentLoaded event just once? Cheers in advance!
  4. Me again with another JavaScript question for you lot. I've started work on a Firefox extension that acts on a particular site, altering various properties of the pages and so on. I've got a semi-working version that needs a revamp to allow me to expand it, so as I hadn't got too far in to it yet I've decided to start from scratch, this time trying to understand a bit more about what's going on with the code. The initial template I used was taken from here, and also shown below: Assuming that the "messagepane" aspect is unnecessary in my case, I'm trying to work out how to translate this in to something that makes sense to me. My first attempt was this: window.addEventListener("load", function() { myExtension.init(); }, false); var myExtension = { function init () { var appcontent = document.getElementById("appcontent"); // browser if ( appcontent ) appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, true); } function onPageLoad (aEvent) { var doc = aEvent.originalTarget; // doc is document that triggered "onload" event // do something with the loaded page. // doc.location is a Location object (see below for a link). // You can use it to make your code executed on certain pages only. alert("test"); } }But it doesn't show an alert. As far as I can tell, the two are (nigh-on) identical, so can someone explain to me the difference between "onPageLoad: function ( aEvent )" and "function onPageLoad (aEvent)", as I assume they're the things responsible for it not working.
  5. Ah, gotcha. Yeah, I see how the $ thing isn't needed now, as what's after the last forward slash is pretty much irrelevant. Cheers for pointing that one out.
  6. Right, after a little bit of trial and error (as well as using various tutorial websites) I came up with the following expression: ^http://(www\.)?example\.com/.*$Seems to work like a charm. It also hasn't got the crazy "\/\/" at the beginning, because as far as I could tell the forward-slash doesn't need escaping. It worked, so if I'm wrong then clearly it's right in some quirky way. Also, I'm not sure why you had a forward slash at the start of your expression and an i at the end, nooc9. As far as I can see they have no significance in regular expressions. Care to comment, or just a slip-up? Any comments on my expression?
  7. Oooh, lots of responses. That's what I like to see! Cheers for the detailed overview there, but I get the impression you misinterpreted my bit about subdomains (I don't want a subdomain URL to be valid). Still, thanks for the suggestions and I'll definitely be looking some of them up! Fair point, though I mentioned it for clarification in case anyone tried to incorporate it in to their example. Looks pretty much the sort of thing I'm after, although what some of that syntax means is a mystery to me. Why the "\/\/"? I'm assuming that backslash is some sort of escape character? Also, nice find with the .match() method. I was simply planning on using .search() and checking if it returned greater than or equal to 0, but that's definitely more the sort of thing that I'm after. Looks like I better go dig up some regexp tutorials and try to decipher some of these expressions! As always, you folks at Trap seem to have the answer I'm looking for, so cheers for that. I'll let you know what I come up with as a final expression when I do. Thanks to all of you!
  8. Hi folks, me again with yet another JavaScript-y problem. Firstly, I have next to no experience with regular expressions, so apologies for any slow-wittedness on my part with this particular topic. I'm trying to use regular expressions (in JavaScript, if it's at all relevant) to work out whether a particular string (the current page URL, not that it really matters) is of the following form: http://(www. optional)example.com(anything else here)I've done a good few searches of Google, but anything that it turns up is either for checking if a string is in a URL format (not for a particular site) or full of strange, spooky regex runes that mean nothing to me. One other parameter for my expression that I should point out: if the URL is a subdomain of example.com (so http://forums.xisto.com/no_longer_exists/ or http://forums.xisto.com/no_longer_exists/) then I want it seen as invalid. I'm likely to be using the .search() method for comparison, if it makes any difference to the regular expression. Anyone care to help out the regex newbie? Extra cookies for anyone who explains their expression, as regular expressions are something that I'd really like to learn a bit of. Thanks in advance!
  9. Getting Pidgin to work for my accounts was a definite pain at first. Even more trouble with my GMail ones. Overall, though, as I use Linux (Fedora Core 11) rather than Windows these days I'm more than happy with it now that I'm over those first few hurdles. I'll admit I've never tried Empathy, but don't really feel the need to. If your IM's not broken, why try to fix it? I don't need any of the snazzy video and voice chats that people reckon Empathy works well with (though we all know that Linux and webcams don't get on), so I'm more than happy with sticking to Pidgin.Is it better than WLM? Tough to call, though in my opinion it feels a bit...cleaner.
  10. The only main issue I'm aware of with XAMPP is its incompatibility with 64-bit Linux (and possibly Windows, but I can't comment on that). There may well be a way to get it to work, but it's certainly not the friendliest thing to do, and doesn't work on it out-of-the-box, so to speak. Other than that, I can certainly recommend XAMPP as an excellent means of testing your PHP scripts before uploading them. Another good alternative is WAMP (only works on Windows, unlucky Linux and Mac users!)One thing I should point out about WAMP is that it stops some of the worries with other server software in that it has a "Go Online" setting that, when off, there's no way anyone can access the files by typing in your IP, firewall or not. If that's a big concern of yours (for whatever reason), go with WAMP just for that peace of mind.
  11. Bringing this topic to the surface again, your suggestion is not dissimilar to how I'm currently doing it. Rather than checking the page URL, I check whether a variable has been defined. If not, redirect them to the "you're not allowed to be here!" page. It works, no doubt about it, but contrary to the saying "if it's not broken, don't fix it" I'm looking for an alternative.Why am I posting here now? Because after all this time I've still not found out much about file permissions. By their very nature they sound like the exact sort of thing that I should be using for doing this. I've still yet to work out exactly how they work - and yet to get the domain for the hosting, but that's slightly besides the point - and would certainly appreciate a bit of help on the matter.Essentially, I'm after the file permissions (in the format ###, with # as a number) required to have a file with the following access attributes:Cannot be written to in any way (all changes must be made by uploading a new file to the server with the same name and replacing it)The server can access the file for include purposes (i.e. the server can read it)The file cannot be directly accessed by the user (generates a 403 error, which I will deal with using a .htaccess file)Any ideas? Other than writing some sort of test scripts for this, I figured this would be the easiest way of getting an answer. Is it in fact possible using file permissions, or is the current method (or the one suggested by Pankyy) a better solution?
  12. Not as such. I looked in to it and it seems that it's pretty much universally "off" unless the user manually (i.e. with a popup box) turns it "on" if the file is stored locally (doesn't work via http protocol), or can be turned "on" by your site being signed using a security certificate (again with a popup, but this time it's allowed online). Nice find with cURL there, looks quite nifty though, I believe, not quite what I'm after for use with frames. Yes, I'm aware that frames are "bad" in a lot of people's eyes, but as far as this objective is concerned they're certainly a fairly nice method. That said, I can most definitely see how it could be used (essentially have the "main" frame on my hosting, but as a .php file, and let it load the contents of the game page). I can then use a chunk of regular expressions and various other searching and replacing methods to alter the contents as I please, or alternatively just use JavaScript to do it. One minor qualm that I have with this approach is that it relies on a non-core extension to PHP, which just rubs me the wrong way. While I'm all for clever little libraries and so on, I definitely prefer not relying on some additional piece of software that I'd have to install on my hosting should I ever want to use my code. It's a little issue, sure, but I'm in favour of not using it nonetheless. For now I reckon I'll be sticking to a much more basic toolbar, then working out how I can get a security certificate (the various sorts, how I pay for it, etc.) that lets me use the functionality I want to (which is part of a default server build). Cheers for the suggestion, however, and it's one that I'll look in to as a cheaper means of doing what I want to do.
  13. Hi technoize! As far as I know, there's some sort of minimum number of posts before myCents starts working (not 100% sure on that, someone else can verify it either way). If there is a minimum, it's in the region of 5 or 10. Either way, you need to make posts to get myCents, and whenever the script updates (there have been a few problems with myCents updates lately, but they seem to have died out for now so it should be fairly regularly, daily at least) your myCents will change to reflect the number and quality of posts you've made.To see your myCents (once you've got them), they'll appear under your name (under "Member No.") in any forum posts you make, so you can simply check any thread you've posted in and find out how many you have. Another alternative is to check your profile. In the leftmost column of it (in the category "Other Information") it will show your myCents. Hope this helps, and welcome to Trap!
  14. Sounds like a definite plan, but I'm not entirely sure how to go about implementing it. When you say "wrap the game in PHP" what sort of method/function are you referring to? If it's possible then it's most definitely an excellent solution to my problem. Other than this, I've been looking in to a few other ways of achieving my goal, but so far with very limited success. Despite finding a very promising page that suggested you could read the URL of any page in the history. This would be pretty much ideal for what I need it for (simply check the last page's URL after loading the new one and storing it in a variable for later loading), however I haven't been able to get any meaningful output from it. Perhaps another set of eyes could make sense of this for me, or perhaps the quote below explains why I have this issue: I'm guessing that this is some client-side setting that essentially stops me from using this method at all? EDIT: After a lot of Googling (a surprisingly tricky subject to find proper information about, I have to admit), I've worked out what UniversalBrowserRead is, though I'll admit my definite uncertainty on the all important question: how do I get it enabled? I suppose this could be viewed as being a question for a different topic, but as it still pertains to my task I'll carry on the discussion here. From what I can work out, the most effective means of obtaining UniversalBrowserRead (as well as a stack of other permissions) is to have a security certificate. These (I believe) remove the concept of risk to the user (by not providing any warning?) and cost some amount ranging from the low tens of dollars to the high hundreds. For the sake of my bank balance, I'm not exactly in favour of this method. My alternative, or at least the only one that I can see assuming that it's provided, is to have a warning pop up every time I try to enable the permission, which isn't such a bad thing given that the site is only a basic one that a few users will actually use, and given that I can explain to them why I need the permission (which would also let me do a heap of other cool, snazzy things) then it's an acceptable workaround. I believe that there will be some serious browser-compatibility issues with it (three cheers for Internet Explorer! ...No? Anyone?), but again assuming that this isn't a problem for my user-base (all faithful Firefox users, as far as I know), the only real problem comes down to actually implementing it. Any suggestions as to alternatives, before I start delving in to this idea?
  15. I already have a link to the pages I need the most in the toolbar frame (with the main frame as the target). However, as I'm planning on letting others use the toolbar I'm going to let them customise it to the pages they need the most (as well as various other customisation options, but suffice to say an area as large as the main frame is needed). I currently have a working toolbar that has some of the features I want in the second version in it, and at the moment you can customise them in the toolbar frame (the div with the toolbar itself and another with the toolbar options toggle between display="none" and not), but already the amount of customisation has meant a scrollbar is pretty much a necessity unless you have an outrageously tall screen. In order to solve this, as well as have extra space for the additional customisation, I also want to have the main frame switch to the settings.html file and back to the last game page you were on when you press a certain button in the toolbar. As I mentioned in my edit, I realise that this can be done with the window.history.back method, but one of the additional functions of the toolbar that I want to introduce is, essentially, a scribble pad where you can write down any notes, pre-write any forum posts (as the game has an annoying tendency of refreshing the page half way through writing a long post and therefore meaning you lose it) and any other use people care to have for it. Naturally this should go in the main frame as well. In a nutshell, the toolbar will have its own navigation menu (which I have mimicking the appearance of the game one, to help it blend better), with links (via javascript) to change the contents of the main frame to the toolbar's settings page, the toolbar's scribble pad and the game page (last viewed page is preferable, to save you having to renavigate to it after changing, say, the toolbar's preferences). Only the relevant two links will be displayed at any one time (as clearly you're already on one of the pages). Whenever one of the links is pressed and the current contents of the main frame is the game then I want its location stored (or title, but I've worked out from my other topic that that's not really possible) so that I can have the "Game" link go back to that page when its pressed. Is this achievable using JavaScript?
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.