Add code tags to Get JSON challenge plus linting

pull/18182/head
Eric Leung 2016-04-19 00:08:29 -07:00
parent 1fe40822cd
commit 8eddb9c87b
1 changed files with 8 additions and 8 deletions

View File

@ -138,7 +138,7 @@
"These properties and their values are often referred to as \"key-value pairs\".",
"Let's get the JSON from Free Code Camp's Cat Photo API.",
"Here's the code you can put in your click event to do this:",
"<blockquote>$.getJSON(\"/json/cats.json\", function(json) {</code></br> $(\".message\").html(JSON.stringify(json));</br>});</blockquote>",
"<blockquote>$.getJSON(\"/json/cats.json\", function(json) {<br> $(\".message\").html(JSON.stringify(json));<br>});</blockquote>",
"Once you've added this, click the \"Get Message\" button. Your Ajax function will replace the \"The message will go here\" text with the raw JSON output from the Free Code Camp Cat Photo API."
],
"challengeSeed": [
@ -175,11 +175,11 @@
"</div>"
],
"tests": [
"assert(code.match(/\\$\\s*?\\(\\s*?(\\\"|\\')\\#getMessage(\\\"|\\')\\s*?\\)\\s*?\\.\\s*?on\\s*?\\(\\s*?(\\\"|\\')click(\\\"|\\')\\s*?\\,\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/gi), 'message: You should have a click handler on the getMessage button to trigger the AJAX request.');",
"assert(code.match(/\\$\\s*?\\(\\s*?(\\\"|\\')\\#getMessage(\\\"|\\')\\s*?\\)\\s*?\\.\\s*?on\\s*?\\(\\s*?(\\\"|\\')click(\\\"|\\')\\s*?\\,\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/gi), 'message: You should have a click handler on the <code>getMessage</code> button to trigger the AJAX request.');",
"assert(code.match(/\\s*?\\}\\s*?\\)\\s*?\\;/gi), 'message: You should have at least one closing set of brackets and parenthesis.');",
"assert(code.match(/\\s*?\\}\\s*?\\)\\s*?\\;/gi) && code.match(/\\,\\s*?function\\s*?\\(\\s*?\\w*?\\s*?\\)\\s*?\\{/gi) && code.match(/\\s*?\\}\\s*?\\)\\s*?\\;/gi).length === code.match(/\\s*?function\\s*?\\(\\s*?\\w*?\\s*?\\)\\s*?\\{/gi).length, 'message: Each callback function should have a closing set of brackets and parenthesis.');",
"assert(code.match(/\\$\\s*?\\.\\s*?getJSON\\s*?\\(\\s*?(\\\"|\\')\\/json\\/cats\\.json(\\\"|\\')\\s*?\\,\\s*?function\\s*?\\(\\s*?json\\s*?\\)\\s*?\\{/gi), 'message: You should be making use of the getJSON method given in the description to load data from the json file.');",
"assert(code.match(/\\$\\s*?\\(\\s*?(\\\"|\\')\\.message(\\\"|\\')\\s*?\\)\\s*?\\.\\s*?html\\s*?\\(\\s*?JSON\\s*?\\.\\s*?stringify\\s*?\\(\\s*?json\\s*?\\)\\s*?\\)/gi), 'message: Don&apos;t forget to make the <code>.html</code> change the contents of the message box so that it contains the result of the getJSON.');"
"assert(code.match(/\\$\\s*?\\.\\s*?getJSON\\s*?\\(\\s*?(\\\"|\\')\\/json\\/cats\\.json(\\\"|\\')\\s*?\\,\\s*?function\\s*?\\(\\s*?json\\s*?\\)\\s*?\\{/gi), 'message: You should be making use of the <code>getJSON</code> method given in the description to load data from the JSON file.');",
"assert(code.match(/\\$\\s*?\\(\\s*?(\\\"|\\')\\.message(\\\"|\\')\\s*?\\)\\s*?\\.\\s*?html\\s*?\\(\\s*?JSON\\s*?\\.\\s*?stringify\\s*?\\(\\s*?json\\s*?\\)\\s*?\\)/gi), 'message: Don&apos;t forget to make the <code>.html</code> change the contents of the message box so that it contains the result of the <code>getJSON</code>.');"
],
"type": "waypoint",
"challengeType": 0,
@ -192,19 +192,19 @@
"Estas propiedades y sus valores a menudo se denominan \" pares llave-valor\".",
"Vamos a obtener el JSON de la API de fotos de gato de Free Code Camp.",
"Aquí está el código que puedes poner en tu evento de pulsación para lograrlo:",
"<blockquote>$.getJSON(\"/json/cats.json\", function(json) {</code></br> $(\".message\").html(JSON.stringify(json));</br>});</blockquote>",
"<blockquote>$.getJSON(\"/json/cats.json\", function(json) {<br> $(\".message\").html(JSON.stringify(json));<br>});</blockquote>",
"Una vez lo añadas, pulsa el botón \"Get Message\". Tu función Ajax sustituirá el texto \"The message will go here\" con la salida JSON en bruto de la API de fotos de gato de Free Code Camp."
],
"titlePt": "Obter um JSON com o método getJSON do jQuery",
"descriptionPt": [
"Também é possivel solicitar os dados de uma fonte externa. É aqui onde as API's entram em jogo. ",
"Também é possivel solicitar os dados de uma fonte externa. É aqui onde as API's entram em jogo.",
"Lembre que as API's - Interface de Programação de Aplicativos - são ferramentas que os computadores usam para se comunicar entre si.",
"A maioria das API's transferem de dados para web em um formato chamado JSON. JSON significa notação de objeto JavaScript (<em>JavaScript Object Notation</em>).",
"Você já usou JSON para criar objetos em JavaScript. O JSON não é mais que as propriedades de um objeto e seus valores atuais, separados entre <code>{</code> e um <code>}</code>. ",
"Você já usou JSON para criar objetos em JavaScript. O JSON não é mais que as propriedades de um objeto e seus valores atuais, separados entre <code>{</code> e um <code>}</code>.",
"Estas propriedades e seus valores são muitas vezes denominados de \" pares chave-valor\".",
"Vamos obter o JSON da API de fotos de gatos do Free Code Camp.",
"Aqui esta o código que você pode por no nosso evento de clique para fazer isso:",
"<blockquote>$.getJSON(\"/json/cats.json\", function(json) {</code></br> $(\".message\").html(JSON.stringify(json));</br>});</blockquote>",
"<blockquote>$.getJSON(\"/json/cats.json\", function(json) {<br> $(\".message\").html(JSON.stringify(json));<br>});</blockquote>",
"Uma vez adicionadas, aperte o botão \"Get Message\". Sua função Ajax substituirá o texto \"The message will go here\" com a saída bruta do JSON da API de gatos do Free Code Camp."
]
},