Skip to content

Commit

Permalink
Fixed extension not working in windows when extension does not open u…
Browse files Browse the repository at this point in the history
…p as a new window.

Root Cause :
Once window.close() is fired subsequent javascript is not executed. So in case of window.close() executing before chrome.tabs.executeScript, the recipe does not execute.
Solution :
Moved window.close after chrome.tabs.executeScript
  • Loading branch information
coding-idiot committed Feb 21, 2016
1 parent 513ad03 commit bebf353
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 62 deletions.
11 changes: 5 additions & 6 deletions src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ $(function () {
chrome.tabs.executeScript(t[0].id, {
code: code
});
chrome.storage.sync.get('settings', function (r) {
if (!r.settings.popup) { //Close the extension if popup is false
window.close();
}
});
}
});
}
Expand All @@ -54,12 +59,6 @@ $(function () {
createRecipeLIs("ls");

var runRecipe = function (recipeId, paramSetName) {
chrome.storage.sync.get('settings', function (r) {
if (!r.settings.popup) { //Close the extension if popup is false
window.close();
}
});

var nn = function () {
var s = document.createElement('script');
s.textContent = 'window.recipe.RecipePlayer(window.recipe["{recipe}"],"{params}")';
Expand Down
112 changes: 56 additions & 56 deletions src/recipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "FillClassicQuestionRecipe",
"title": "Fill Any Classic Question Type",
"description": "Fill TF, TE, ET, TDD, MS & MC question types",
"project" : "edulastic",
"project": "edulastic",
"type": "parent",
"version": "0.1",
"params": {
Expand All @@ -27,7 +27,7 @@
"id": "AttemptAssignmentRecipe",
"title": "Attempt Any Classic Question Type",
"description": "Attempt TF, TE, ET, TDD, MS & MC question types",
"project" : "edulastic",
"project": "edulastic",
"type": "child",
"version": "0.1",
"params": {
Expand All @@ -49,56 +49,56 @@
"mc": {
"qtype": 116
}
}
}
},
{
"id" : "AttemptStudentAssignmentRecipe",
"title" : "Attempt assignment with classic question type",
"project" : "edulastic",
"type" : "parent",
"version" : "0.1"
"id": "AttemptStudentAssignmentRecipe",
"title": "Attempt assignment with classic question type",
"project": "edulastic",
"type": "parent",
"version": "0.1"
},
{
"id" : "AttemptTrueFalseRecipe",
"title" : "Attempt true false ",
"project" : "edulastic",
"id": "AttemptTrueFalseRecipe",
"title": "Attempt true false ",
"project": "edulastic",
"type": "child"
},
{
"id" : "AttemptTextEntryRecipe",
"title": "Attempt TextEntry question",
"project" : "edulastic",
"type" : "child"
"id": "AttemptTextEntryRecipe",
"title": "Attempt TextEntry question",
"project": "edulastic",
"type": "child"
},
{
"id" : "AttemptEssayRecipe",
"title": "Attempt Essay question",
"project" : "edulastic",
"type" : "child"
"id": "AttemptEssayRecipe",
"title": "Attempt Essay question",
"project": "edulastic",
"type": "child"
},
{
"id" : "AttemptTextDropdownRecipe",
"title": "Attempt TextDropdown question",
"project" : "edulastic",
"type" : "child"
"id": "AttemptTextDropdownRecipe",
"title": "Attempt TextDropdown question",
"project": "edulastic",
"type": "child"
},
{
"id" : "AttemptMultipleSelectRecipe",
"title": "Attempt MultipleSelection question",
"project" : "edulastic",
"type" : "child"
"id": "AttemptMultipleSelectRecipe",
"title": "Attempt MultipleSelection question",
"project": "edulastic",
"type": "child"
},
{
"id" : "AttemptMultipleChoiceRecipe",
"title": "Attempt MultipleChoice question",
"project" : "edulastic",
"type" : "child"
"id": "AttemptMultipleChoiceRecipe",
"title": "Attempt MultipleChoice question",
"project": "edulastic",
"type": "child"
},
{
"id": "FillTrueFalseRecipe",
"title": "Fill TrueFalse Question",
"description": "It will fill T/F question, solution, hint & answerChoices",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child",
"params": {
Expand All @@ -114,7 +114,7 @@
"id": "FillTextEntryRecipe",
"title": "Fill TextEntry Question",
"description": "It will fill Text Entry question, solution, hint & answerChoice",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child",
"params": {
Expand All @@ -130,7 +130,7 @@
"id": "FillEssayRecipe",
"title": "Fill Essay Question",
"description": "It will fill Essay question, solution, hint",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child",
"params": {
Expand All @@ -146,7 +146,7 @@
"id": "FillTextDropdownRecipe",
"title": "Fill Text Dropdown Question",
"description": "It will fill Text Dropdown question, solution, hint",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child",
"params": {
Expand All @@ -162,7 +162,7 @@
"id": "FillMultipleSelectionRecipe",
"title": "Fill Multiple Selection Question",
"description": "It will fill Multiple Selection question, solution, hint & answerChoices",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child",
"params": {
Expand All @@ -178,7 +178,7 @@
"id": "FillMultipleChoiceRecipe",
"title": "Fill Multiple Choice Question",
"description": "It will fill Multiple Choice question, solution, hint & answerChoices",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child",
"params": {
Expand All @@ -194,63 +194,63 @@
"id": "PassageCreateRecipe",
"title": "Create Assessment with passage having 3 T/F questions",
"description": "Creates Assessment with passage having 3 T/F questions",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "parent"
},
{
"id": "TrueFalseCreateRecipe",
"title": "Create Assessment with one True False Question",
"description": "Creates Assessment with one TrueFalse question",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child"
},
{
"id": "TextEntryCreateRecipe",
"title": "Create Assessment with one Text Entry Question",
"description": "Creates Assessment with one TextEntry question",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child"
},
{
"id": "EssayCreateRecipe",
"title": "Create Assessment with one Essay Question",
"description": "Creates Assessment with one Essay question",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child"
},
{
"id": "TextDropdownCreateRecipe",
"title": "Create Assessment with one Text Dropdown Question",
"description": "Creates Assessment with one TextDropdown question",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child"
},
{
"id": "MultipleSelectionCreateRecipe",
"title": "Create Assessment with one Multiple Selection Question",
"description": "Creates Assessment with one MultipleSelection question",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child"
},
{
"id": "MultipleChoiceCreateRecipe",
"title": "Create Assessment with one Multiple Choice Question",
"description": "Creates Assessment with one MultipleChoice question",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "child"
},
{
"id": "CreateAssessmentWithClassicQuestionRecipe",
"title": "Create Assessment with one Classic Question",
"description": "Creates Assessment with one Classic question",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "parent",
"params": {
Expand Down Expand Up @@ -278,7 +278,7 @@
"id": "AddClassicQuestionToAssessmentRecipe",
"title": "Add Classic Question to Assessment",
"description": "Adds a classic question to assessment being review (#assessmentReview/close)",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "parent",
"params": {
Expand Down Expand Up @@ -306,21 +306,21 @@
"id": "OpenQuestionAuthoringRecipe",
"title": "",
"description": "From LOSV will select Create and then T/F questionType",
"project" : "edulastic",
"project": "edulastic",
"type": "child"
},
{
"id": "CreateAssessmentRecipe",
"title": "",
"description": "Will navigate to #createAssessment/close?cm=assessment and click on Create",
"project" : "edulastic",
"project": "edulastic",
"type": "child"
},
{
"id": "LoginRecipe",
"title": "Login",
"description": "Login into Edulastic",
"project" : "edulastic",
"project": "edulastic",
"type": "parent",
"params": {
"default": {
Expand All @@ -345,7 +345,7 @@
"id": "FillSolutionHintRecipe",
"title": "",
"description": "",
"project" : "edulastic",
"project": "edulastic",
"type": "child",
"params": {
"solution": "Some sample solution",
Expand All @@ -356,7 +356,7 @@
"id": "LoginLSRecipe",
"title": "Login(LS)",
"description": "Login into LS",
"project" : "ls",
"project": "ls",
"type": "parent",
"params": {
"instructor": {
Expand All @@ -373,7 +373,7 @@
"id": "CreateLSAssignmentRecipe",
"title": "Create an Assignment(LS)",
"description": "Creates an Assignment using on of the options",
"project" : "ls",
"project": "ls",
"version": "0.1",
"type": "parent",
"params": {
Expand All @@ -392,7 +392,7 @@
"id": "AssignAssessmentRecipe",
"title": "Assign Assessment",
"description": "Assigns an assessment which is in review screen",
"project" : "edulastic",
"project": "edulastic",
"version": "0.1",
"type": "parent",
"params": {
Expand All @@ -408,7 +408,7 @@
"id": "LoginGliderRecipe",
"title": "Glider Login",
"description": "Login into Glider",
"project" : "glider",
"project": "glider",
"type": "parent",
"params": {
"hm": {
Expand All @@ -434,10 +434,10 @@
}
},
{
"id" : "SignUpFlowFillCompanyDetailsRecipe",
"id": "SignUpFlowFillCompanyDetailsRecipe",
"title": "Sign Up Employer : Company Name Page",
"description": "Fill Company Name & Location",
"project" : "glider",
"project": "glider",
"type": "parent"
}
]

0 comments on commit bebf353

Please sign in to comment.