Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

javascript obfuscator error.

Posted on 2014-02-03
2
588 Views
Last Modified: 2014-02-04
I have developing quiz activity. I want to hide answer and scores from src code. So I have chose javascript obfuscator "http://javascriptobfuscator.com/". It throws strange error. How to solve this issue?
JS code:

		$(function()
		    {

		        $("#quiz-content1").sliding_quiz ({
					 'instruction':
					 {
					 	'title': 'Sliding Quiz',
					 	'description' : 'Sliding Quiz is a powerful solution for creating interactive quizzes..'
					 },
					'questions':
					[
                        {
                            'id'        : 1,
                            'question'  : 'What years did Brazil win the world cup?',
                            'answers'   : ['1994', '1998', '2006', '2010'],
                            'weight'     : [10, 1, 2, 3],
                            'explanation'  : 'Visit here to check <a href="http://en.wikipedia.org/wiki/FIFA_World_Cup" target="_blank">http://en.wikipedia.org/wiki/FIFA_World_Cup</a>'
                        },
                        {
                            'id'        : 2,
                            'question'  : 'Which is the only country to have played in every World Cup since it started in 1930?',
                            'answers'   : ['England', 'Germany', 'Brazil'],
                            'weight'     : [3, 5, 10],

                        }
					],
					'locale': //optional
					{
						'msg_not_found' : 'Cannot find questions',
						'msg_please_select_an_option' : 'Please select an option',
						'msg_question' : 'Question',
						'msg_you_scored' : 'You scored',
						'msg_click_to_review' : 'Click to Question button to review your answers',
						'bt_next' : 'Next',
						'bt_back' : 'Back',
						'bt_finish' : 'Finish',
						'bt_contact' : 'Submit Your Score',
						'contact_heading' : 'Submit Your Score',
						'contact_name' : 'Name',
						'contact_email' : 'Email',
						'contact_phone' : 'Phone',
						'contact_message' : 'Message',
						'contact_thankyou' : 'Thank you for your submission. <a href="http://goo.gl/kPdmL" target="_blank">Click here to check mail</a>'
					},
					'when_finish_submit_url': 'server_response.php',
					'contact_form_submit_url': 'submit_answers.php',
					//'effect': 'fade'
				});
			});
	

Open in new window


Obfuscator Error:

JScriptCodeDom.CodeParseException: Unexcepted Token : Comma , Requires QuoteEnd , Line 15, Char 65 ---> System.Exception: Unexcepted Token : Comma , Requires QuoteEnd
   at JScriptCodeDom.CodeParser.ReadAndCheckToken(CodeTokenType equalto)
   at JScriptCodeDom.CodeParser.ContinueExpressionCore(CodeExpression leftexp)
   at JScriptCodeDom.CodeParser.ContinueExpression(CodeExpression leftexp)
   at JScriptCodeDom.CodeParser.ParseFullExpression(Boolean bthrowerror)
   at JScriptCodeDom.CodeParser.InternalParseStatementCore()
   at JScriptCodeDom.CodeParser.InternalParseStatement()
   at JScriptCodeDom.CodeParser.ParseStatement()
   at JScriptCodeDom.CodeParser.Parse(String code)
   --- End of inner exception stack trace ---
   at JScriptCodeDom.CodeParser.Parse(String code)
   at JScriptProtector.Protector.Protect(String[] codes)
   at JScriptProtector.Protector.Protect(String code)
   at Jsps._Default.Button1_Click(Object sender, EventArgs e)

Open in new window

0
Comment
Question by:JohnLourdu
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 39831920
When you delete a line (line 24) or comment it out (line 47) you need to take care that the comma at the end of the previous line is also removed/commented out.

Here is a corrected version:
		$(function()
		    {

		        $("#quiz-content1").sliding_quiz ({
					 'instruction':
					 {
					 	'title': 'Sliding Quiz',
					 	'description' : 'Sliding Quiz is a powerful solution for creating interactive quizzes..'
					 },
					'questions':
					[
                        {
                            'id'        : 1,
                            'question'  : 'What years did Brazil win the world cup?',
                            'answers'   : ['1994', '1998', '2006', '2010'],
                            'weight'     : [10, 1, 2, 3],
                            'explanation'  : 'Visit here to check <a href="http://en.wikipedia.org/wiki/FIFA_World_Cup" target="_blank">http://en.wikipedia.org/wiki/FIFA_World_Cup</a>'
                        },
                        {
                            'id'        : 2,
                            'question'  : 'Which is the only country to have played in every World Cup since it started in 1930?',
                            'answers'   : ['England', 'Germany', 'Brazil'],
                            'weight'     : [3, 5, 10] //,

                        }
					],
					'locale': //optional
					{
						'msg_not_found' : 'Cannot find questions',
						'msg_please_select_an_option' : 'Please select an option',
						'msg_question' : 'Question',
						'msg_you_scored' : 'You scored',
						'msg_click_to_review' : 'Click to Question button to review your answers',
						'bt_next' : 'Next',
						'bt_back' : 'Back',
						'bt_finish' : 'Finish',
						'bt_contact' : 'Submit Your Score',
						'contact_heading' : 'Submit Your Score',
						'contact_name' : 'Name',
						'contact_email' : 'Email',
						'contact_phone' : 'Phone',
						'contact_message' : 'Message',
						'contact_thankyou' : 'Thank you for your submission. <a href="http://goo.gl/kPdmL" target="_blank">Click here to check mail</a>'
					},
					'when_finish_submit_url': 'server_response.php',
					'contact_form_submit_url': 'submit_answers.php' //,
					//'effect': 'fade'
				});
			});

Open in new window

0
 

Author Closing Comment

by:JohnLourdu
ID: 39832060
Thanks, it works like a charm.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question