-1

I am getting a syntax error on line 13... line 13:

"c001": {type:"tool", id: "webconference", name:"Web Conference Tool"}, // web conference

Can you help me fix this? :) Thanks.

//assuming jquery exists

/* notes:
    a lot of the functions need to either return jQuery or jQuery.ib, and if jQuery.ib then I need a .stop() function that returns jQuery 

*/



(function(){
    jQuery.fn.extend({ibSetup: function(){
        toolmap: {
            "c001": {type:"tool", id: "webconference", name:"Web Conference Tool"},             // web conference 
            "c002": {type:"alias", "main": "c001"},         // web conference yearly
            "c024": {type:"tool", id: "webconference-package", name:"Web Conference tool"}, // web conference tool package version 
            "c0something": {type:"tool", id:"webconference-premium", name:"Premium Web conference Tool"}, // premium wc

            "c053": {type:"alias", "main":"c024"},          // signature bronze (wc tool)
            "c075": {type:"alias", "main":"c024"},          // signature bronze (wc tool) quarterly
            "c054": {type:"alias", "main":"c024"},          // signature bronze (wc tool) yearly

            "c004": {type:"tool", id: "template", name:"Template Tool"},                // template tool
            "c008": {type:"alias", "main":"c004"},          // template tool yearly 

            //check quantity on these;
            "c018": {type:"tool", id: "template-extrauser", quantity:1, name:"Template Tool Extra User"},       // template tool 1st extra user - $12.47
            "c019": {type:"tool", id: "template-extrauser", quantity:"check", name:"Template Tool Extra User", "extends":"c018"},   // template tool additional users - $10.00

            "c020": {type:"tool", id: "businessresponder", name:"Business Responder Tool"},             // business responder tool
            "c021": {type:"alias", "main":"c020"},          // business responder tool yearly

            "c005": {type:"tool", id: "volumemarketing", name:"Volume Marketing Tool"},             // volume marketing tool


            //packages:
            "c025": {type:"package", tools:["c024","c004","c020"], name:"USABG Starter Package"},   // USABG Starter Package: GUESSED AT TOOLS

            "c077": {type:"package", tools:["c004","c020","c005"], name:"Ultimate Template Package"},   // ultimate template: ett, br, marketing

            "c027": {type:"package", tools:["c024","c004","c020"], name:"Essential Silver Package"},    // silver package: wc, ett, br
            "c075": {type:"alias", "main":"c027"},              // sp quarterly
            "c076": {type:"alias", "main":"c027"},              // sp semi-annually
            "c028": {type:"alias", "main":"c027"},              // sp yearly, 

            "c050": {type:"alias", "main":"c027"},              // sig sp, 
            "c051": {type:"alias", "main":"c027"},              // sig sp semi-annually, 
            "c080": {type:"alias", "main":"c027"},              // sig sp quarterly, 
            "c052": {type:"alias", "main":"c027"},              // sig sp yearly; 

            "c023": {type:"package", tools:["c024","c004","c020"], name:"Vital Gold Package"},  // gold package: silver + subsite (and this script doesn't do the websites.. yet.)
            "c073": {type:"alias", "main":"c023"},              // gp quarterly
            "c074": {type:"alias", "main":"c023"},              // gp semi-annually
            "c030": {type:"alias", "main":"c023"},              // gp yearly

            "c031": {type:"alias", "main":"c023"},              // sig gp 
            "c081": {type:"alias", "main":"c023"},              // sig gp quarterly
            "c039": {type:"alias", "main":"c023"},              // sig gp semi-annually
            "c032": {type:"alias", "main":"c023"},              // sig gp yearly

            "c022": {type:"package", tools:["c024","c004","c020","c005"], name:"Full Platinum Package"}, // platinum package: silver + website + volume marketing tool
            "c071": {type:"alias", "main":"c022"},              // pp quarterly
            "c072": {type:"alias", "main":"c022"},              // pp semi-annually
            "c029": {type:"alias", "main":"c022"},              // pp yearly

            "c***": {type:"manual", name:""}                // other tool template
        },
        tools: [],
        cookies: {
            "salutation": "",
            "fname": "",
            "lname": "",
            "email": "",
            "password" : "",
            "title": "",
            "company": "", 
            "address": "", 
            "address2": "",         // may not exist!
            "city": "", 
            "state": "", 
            "zip": "", 
            "phone": "", 
            "tollfree": "", 
            "cell": "", 
            "fax": "",  
            "website": "", 
            "country": "", 
            "dob": "", 
            "spouse": "", 
            "spousedob": "", 
            "repnum": "" //otherwise refered to as repid; may not exist
        },
        getTool: function(partno){
            if(typeof toolmap[partno] == "undefined") return false;
            else if(toolmap[partno].type == "alias") partno = toolmap[partno].main;
            return toolmap[partno];
        },
        getToolString: function(partno,qty) 
        {
            var str = "";
            var amp = false;
            function makeStringPiece(partno){
                var tool=getTool(partno);
                if(!tool) return false;
                if(tool.type=="package") {
                    for(i in tool.tools){
                        str += makeStringPiece(tool.tools[i]);
                    }
                }
                else{
                    this.amp ? str += "&" : this.amp = true;
                    str += "tool[]="+tool.id; //"+this.counter+"
                    this.counter++;
                    if(tool.quantity) { 
                        str += "&" + tool.quantity=="check" ? this.qty : tool.qty;
                    }
                }
            };
            makeString(partno);
            return str;
        },

        //filter and foreach from http://eloquentjavascript.net/
        filter: function (array, test) {
            var result = [];
            forEach(array, function (element) {
            if (test(element))
                result.push(element);
            });
            return result;
        },
        forEach: function(array, action) {
          for (var i = 0; i < array.length; i++)
            action(array[i]);
        },

        readTools: function(){
            for(partno in toolmap){ //I might need to change this to use .each()
                var t = readCookie(partno)
                if(t) tools.push(t);
            };
        },
        readUser: function(){
            for(name in cookies){
                cookies[name] = readCookie(name);
            }
        },

        createCookie: function(name,value,days) {
            if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();
            }
            else var expires = "";
            document.cookie = name+"="+value+expires+"; path=/";
        },

        readCookie: function(name) {
            var nameEQ = name + "=";
            var ca = document.cookie.split(';');
            for(var i=0;i < ca.length;i++) {
                var c = ca[i];
                while (c.charAt(0)==' ') c = c.substring(1,c.length);
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
            }
            return null;
        },

        eraseCookie: function(name) {
            createCookie(name,"",-1);
        }

    }}); //close function, close extend object, close extend()
})(); // close and execute my anonymous function
1
  • Try wrapping your keys in quotes, eg "type".. maybe an interpreter expects that to be a reserved word Commented Aug 16, 2010 at 16:15

1 Answer 1

3

JSLint complains about line 12

When I tried changing:

toolmap: {

to:

toolmap = {

that seemed to fix the problem.

Sign up to request clarification or add additional context in comments.

4 Comments

Yep. "toolmap" isn't in an object - you're using it/declaring it inside of a function.
OK I see. So if I change the remaining STUFF: ... it should work?
by that mean the ones that have a semicolon in a method.
Probably should be var toolmap = { ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.