What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » including files

including files
Author: Message:
Zeelia
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2007
O.P. including files
Hi!
I have a JavaScript which includes files just as the PHP function called include:
quote:
include("filename");
so what i need is to get the code configured so that it works with msg-plus-live-script. The errors i get are the bold parts of the script which tells me undefined variable or something like that.

code:
function include( filename ) {
    // http://kevin.vanzonneveld.net
    // +   original by: mdsjack (http://www.mdsjack.bo.it)
    // +   improved by: Legaev Andrey
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Michael White (http://crestidg.com)
    // %        note 1: Force Javascript execution to pause until the file is loaded. Usually causes failure if the file never loads. ( Use sparingly! )
    // *     example 1: include('/pj_test_supportfile_2.js');
    // *     returns 1: 1

    var js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', filename);
    js.setAttribute('defer', 'defer');
    document.getElementsByTagName('HEAD')[0].appendChild(js);

    // save include state for reference by include_once
    var cur_file = {};
    cur_file[window.location.href] = 1;

    if (!window.php_js) window.php_js = {};
    if (!window.php_js.includes) window.php_js.includes = cur_file;
    if (!window.php_js.includes[filename]) {
        window.php_js.includes[filename] = 1;
    } else {
        window.php_js.includes[filename]++;
    }

    return window.php_js.includes[filename];
}


so those ore the errors which i have bumped into until now.
so can someone please translate this so that it works with msgpluslive script or tell me another way of including files?
//Zeelia :D

PS: why i want to include files, i think this is a much more easier way of changing language of the application, so that's why. And i find it much harder to write everything in variables in the same .js file and if(language=="english"){ var ... = "..."; } i think that, that method is harder or maybe more time-taking for each language you'll have on your application.
05-07-2008 11:14 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
including files - by Zeelia on 05-07-2008 at 11:14 PM
RE: including files - by CookieRevised on 05-08-2008 at 11:52 AM
RE: including files - by Zeelia on 05-08-2008 at 03:42 PM
RE: including files - by CookieRevised on 05-08-2008 at 04:37 PM
RE: including files - by Zeelia on 05-08-2008 at 05:30 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On