{"id":28470,"date":"2017-02-26T03:01:52","date_gmt":"2017-02-25T17:01:52","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=28470"},"modified":"2017-03-26T15:39:13","modified_gmt":"2017-03-26T05:39:13","slug":"english-noun-or-pronoun-case-cookie-sharing-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/english-noun-or-pronoun-case-cookie-sharing-tutorial\/","title":{"rendered":"English Noun or Pronoun Case Cookie Sharing Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.htm\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"English Noun or Pronoun Case Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that_cookie_email_ask.jpg\" title=\"English Noun or Pronoun Case Cookie Sharing Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">English Noun or Pronoun Case Cookie Sharing Tutorial<\/p><\/div>\n<p>Individually, we&#8217;ve raved on about &#8230;<\/p>\n<ul>\n<li>Add your own data entry to a game <font size=1>(ie. interactive input, or user interaction)<\/font><\/li>\n<li>Email<\/li>\n<li>Cookies<\/li>\n<\/ul>\n<p> &#8230; a lot at this blog, generally, and today, we continue on that, but there&#8217;s nothing to be sheepish about doing that for two main reasons, in our books <font size=1>&#8230; but not our pamphlettes &#8230;<\/font> <font size=2>sheep grazier&#8217;s alert RE <b>reused joke<\/b>!? &#8230; see you at the foul line<\/font> &#8230;<\/p>\n<ul>\n<li>they are all really useful concepts and they can all be worked not needing to delve into any serverside code, as for today&#8217;s <i>purely<\/i> clientside (Javascript) usage &#8230; and &#8230;<\/li>\n<li>think today&#8217;s case is the first <font size=1>(we&#8217;ve noticed, but there may have been others)<\/font> where we feel like we are transferring data (not this time in the Email ether (that we like to do)) but the <i>Cookie ether<\/i> in that we are transferring and merging the data from an Emailer&#8217;s Cookies to the Emailee&#8217;s Cookies (and consequently onto the sentence (data) list of their game)<\/li>\n<\/ul>\n<p> &#8230; all to enhance the Sharing capabilities of the <a title='English Noun or Pronoun Case Primer Tutorial' href='#enopcpt'>English Noun or Pronoun Case Primer Tutorial<\/a> project we started out on yesterday.<\/p>\n<p>So what is a &#8220;summary&#8221; of &#8220;cheat sheet&#8221; Javascript aspects that make those three things work in the web application <i>client<\/i> space?  For us (and you will undoubtedly know others), it&#8217;s &#8230;<\/p>\n<ul>\n<li><i>Add your own data entry to a game<\/i> &#8230; use Javascript&#8217;s <a target=_blank title='Javascript prompt window information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_prompt.asp'>prompt<\/a> window<\/li>\n<li><i>Email<\/i> &#8230; use an HTML <a target=_blank title='HTML a tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_a.asp'><i>a<\/i><\/a> link <a target=_blank title='HTML a tag href property information from w3schools' href='http:\/\/www.w3schools.com\/tags\/att_a_href.asp'><i>href<\/i><\/a> property pointing at a <a target=_blank title='mailto information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tryit.asp?filename=tryhtml_link_mailto'><i>mailto:<\/i><\/a> type of URL that is (&#8220;revalued&#8221; and) activated, when actioned by the user, via an <a target=_blank title='Javascript event onload information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ev_onclick.asp'><i>onclick<\/i><\/a> mouse (and\/or touch) event<\/li>\n<li><i>Cookies<\/i> &#8230; we like <em>&#8220;JavaScript &amp; Ajax&#8221; seventh edition by Tom Negrino and Dori Smith<\/em> advice here, but generally <a target=_blank title='Cookie information from w3schools' href='http:\/\/www.w3schools.com\/js\/js_cookies.asp'><i>HTTP Cookies<\/i><\/a> (at the client side Javascript) end of the web application are coded for <i>set<\/i> and <i>get<\/i> respectively (linking URL get parameters (aka <i>?casesentences=[userAddedSentences]<\/i>) <font size=1>&#8230; that probably derive from an Email&#8217;s URL &#8220;sharing&#8221; link &#8230;<\/font> to the <i>sentences<\/i> array data) via code that references the DOM&#8217;s <a target=_blank title='Javascript cookie usage information from w3schools' href='http:\/\/www.w3schools.com\/js\/js_cookies.asp'><i>document.cookie<\/i><\/a> like &#8230;<br \/>\n<code><br \/>\nvar mores = (location.search.split('casesentences=')[1] ? decodeURIComponent(location.search.split('casesentences=')[1].split('&')[0]) : '');<br \/>\n<b><\/b><br \/>\nfunction cs_setCookie(thisg) { \/\/ thanks to JavaScript and Ajax by Tom Negrino and Dori Smith<br \/>\n   var expireDate = new Date();<br \/>\n   expireDate.setMonth(expireDate.getMonth()+6);<br \/>\n   document.cookie = \"casesentences=\" + encodeURIComponent(thisg) + \";expires=\" + expireDate.toGMTString();<br \/>\n}<br \/>\n<b><\/b><br \/>\nfunction cs_cookieVal(firstcall) {<br \/>\n  if (firstcall && mores != '') {<br \/>\n   if (document.cookie == '') {<br \/>\n     extras=mores;<br \/>\n     cs_setCookie(mores);<br \/>\n   } else {<br \/>\n     extras=cs_cookieVal(false) + ',' + mores;<br \/>\n     var xms=decodeURIComponent(extras).split(' ,');<br \/>\n     var xextras='';<br \/>\n     var xextradelim='';<br \/>\n     for (var ixms=0; ixms&lt;xms.length; ixms++) {<br \/>\n          if (eval(ixms + 1) == xms.length) {<br \/>\n            if (sentences.indexOf(xms[ixms]) == -1) {<br \/>\n             xextras+=xextradelim + xms[ixms];<br \/>\n             xextradelim=\",\";<br \/>\n             sentences.push(xms[ixms]);<br \/>\n            }<br \/>\n          } else {<br \/>\n            if (sentences.indexOf(xms[ixms] + ' ') == -1) {<br \/>\n             xextras+=xextradelim + xms[ixms] + ' ';<br \/>\n             xextradelim=\",\";<br \/>\n             sentences.push(xms[ixms] + ' ');<br \/>\n            }<br \/>\n          }<br \/>\n     }<br \/>\n     if (xextras != extras) {<br \/>\n       cs_setCookie(xextras);<br \/>\n       extras=xextras;<br \/>\n       mores='';<br \/>\n       return extras;<br \/>\n     }<br \/>\n   }<br \/>\n   mores='';<br \/>\n  }<br \/>\n  if (document.cookie != '') {<br \/>\n   var tCookie=document.cookie.split(\"; \");<br \/>\n   for (var j=0; j&lt;tCookie.length; j++) {<br \/>\n    if (\"casesentences\" == tCookie[j].split(\"=\")[0]) {<br \/>\n      if (firstcall && decodeURIComponent(tCookie[j].split(\"=\")[1]) != \"\") {<br \/>\n        var ms=decodeURIComponent(tCookie[j].split(\"=\")[1]).split(' ,');<br \/>\n        for (var ims=0; ims&lt;ms.length; ims++) {<br \/>\n          if (eval(ims + 1) == ms.length) {<br \/>\n            extras+=extradelim + ms[ims];<br \/>\n            extradelim=\",\";<br \/>\n            sentences.push(ms[ims]);<br \/>\n          } else {<br \/>\n            extras+=extradelim + ms[ims] + ' ';<br \/>\n            extradelim=\",\";<br \/>\n            sentences.push(ms[ims] + ' ');<br \/>\n          }<br \/>\n        }<br \/>\n      }<br \/>\n      return decodeURIComponent(tCookie[j].split(\"=\")[1]);<br \/>\n    }<br \/>\n   }<br \/>\n  }<br \/>\n  return '';<br \/>\n}<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p>Maybe this &#8220;Cookie Ether&#8221; (or maybe it should be called <i><font size=1>Clients in S<\/font><font size=2>p<\/font><font size=3>a<\/font><font size=4>c<\/font><font size=5>e<\/font><\/i>) could be used again &#8230; we&#8217;ll see &#8230; but for now we&#8217;ll leave you with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.htm\" title='Click picture'>live run<\/a> link that has this underlying HTML and Javascript <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.html-GETME\" title='what_case_is_that.htm'>what_case_is_that.htm<\/a> code you could peruse, and which changed for the functionality &#8220;favourites&#8221; above in <a target=_blank href=\"http:\/\/www.rjmprogramming.om.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.html-GETME\" title='what_case_is_that.htm'>this way<\/a>.<\/p>\n<hr>\n<p id='enopcpt'>Previous relevant <a target=_blank title='English Noun or Pronoun Case Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/english-noun-or-pronoun-case-primer-tutorial\/'>English Noun or Pronoun Case Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"English Noun or Pronoun Case Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.jpg\" title=\"English Noun or Pronoun Case Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">English Noun or Pronoun Case Primer Tutorial<\/p><\/div>\n<p>Seems like English Grammar learning may be <a target=_blank title='NSW HSC shake up' href='http:\/\/www.smh.com.au\/nsw\/nsw-hsc-back-to-the-future-in-first-major-overhaul-of-the-syllabus-in-20-years-20170220-gugoum.html'>coming back into fashion<\/a> here in New South Wales, in Australia.  To celebrate, we&#8217;ve written an English sentence game where you classify a noun or pronoun within that sentence regarding <i>case<\/i> choices &#8230;<\/p>\n<ul>\n<li>Nominative<\/li>\n<li>Accusative<\/li>\n<li>Genitive<\/li>\n<li>Dative<\/li>\n<\/ul>\n<p>This game could well suit <a target=_blank title='ESL information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/English_as_a_second_or_foreign_language'>ESL<\/a> students as well, who may be familiar with these Noun or Pronoun Cases with their own native language.<\/p>\n<p>We structure the web application written in HTML and Javascript as a randomly selected sentence with the <b>noun<\/b> or <b>pronoun<\/b> highlighted <b>bold<\/b> and the sentence&#8217;s <i>verb<\/i> is <i>itallicized<\/i>, because we present some (optional) hints, in the game, which we&#8217;ll also show below &#8230; for the sentence &#8230;<\/p>\n<p><code><br \/>\nSarah <i>gave<\/i> <b>me<\/b> a chocolate.<br \/>\n<\/code><\/p>\n<div id=\"hints\" style=\"background-color:yellow;\">\n<p>Accusative: <a target=\"_blank\" title=\"Accusative link, thanks\" href=\"http:\/\/www.grammar-monster.com\/glossary\/accusative_case.htm\">The accusative case&#8217;s main function is to show the direct object of a verb.<\/a>  To find direct object &#8230; gave what (or whom)?<br \/>Nominative: <a target=\"_blank\" title=\"Nominative link, thanks\" href=\"http:\/\/www.dailywritingtips.com\/what-is-dative-case\/\">A noun or pronoun is in the Nominative Case when it is the subject of a sentence, or when it completes a being verb.<\/a>  To find subject &#8230; who or what gave?<br \/>Genitive: <a target=\"_blank\" title=\"Genitive link, thanks\" href=\"http:\/\/www.dailywritingtips.com\/what-is-dative-case\/\">A noun or pronoun is in the Genitive Case when it shows possession.<\/a><br \/>Dative: <a target=\"_blank\" title=\"Dative link, thanks\" href=\"http:\/\/www.dailywritingtips.com\/what-is-dative-case\/\">A noun or pronoun is in the Dative Case when it is used as an indirect object.<\/a>   If a sentence contains two objects, it will have a direct object and an indirect object. To find the direct object &#8230; gave what (or whom)?  To find the indirect object &#8230; gave to whom\/to what\/for whom\/for what\/on what?<\/p>\n<p><\/div>\n<p>You can try this out for yourself today, as with WordPress 4.1.1&#8217;s <a target=_blank title='English Noun or Pronoun Case Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/english-noun-or-pronoun-case-primer-tutorial\/'>English Noun or Pronoun Case Primer Tutorial<\/a>, via this <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.html\" title=\"Click picture\">live run<\/a> link whose underlying HTML and Javascript code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/what_case_is_that.html_GETME\" title=\"what_case_is_that.html\">what_case_is_that.html<\/a> for your perusal.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d28450' onclick='var dv=document.getElementById(\"d28450\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/esl\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d28450' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d28470' onclick='var dv=document.getElementById(\"d28470\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/cookie\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d28470' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Individually, we&#8217;ve raved on about &#8230; Add your own data entry to a game (ie. interactive input, or user interaction) Email Cookies &#8230; a lot at this blog, generally, and today, we continue on that, but there&#8217;s nothing to be &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/english-noun-or-pronoun-case-cookie-sharing-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,15,37],"tags":[2143,1860,354,380,388,396,537,576,617,652,2011,849,997,1761,2144,1119,1133,1137,2086,1319,1865,1452],"class_list":["post-28470","post","type-post","status-publish","format-standard","hentry","category-elearning","category-games","category-tutorials","tag-case","tag-cookie","tag-dom","tag-email","tag-english","tag-esl","tag-grammar","tag-html","tag-interactive","tag-javascript","tag-noun","tag-object","tag-programming","tag-prompt","tag-pronoun","tag-sentence","tag-share","tag-sharing","tag-subject","tag-tutorial","tag-verb","tag-word"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28470"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=28470"}],"version-history":[{"count":13,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28470\/revisions"}],"predecessor-version":[{"id":29129,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28470\/revisions\/29129"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=28470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=28470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=28470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}