Solved

javascript obfuscator error.

Posted on 2014-02-03
2
596 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
[X]
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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

There is a huge demand for CodeIgniter among the PHP web developers due to its dynamic features and benefits these days. It is one of most popular and agile open source PHP framework for creating robust web applications in PHP web development field.…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

695 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