{"id":704,"date":"2017-08-28T19:56:18","date_gmt":"2017-08-28T19:56:18","guid":{"rendered":"http:\/\/sls.gmu.edu\/web\/?p=704"},"modified":"2017-08-28T19:58:00","modified_gmt":"2017-08-28T19:58:00","slug":"remove-periods-from-degrees","status":"publish","type":"post","link":"https:\/\/sls.gmu.edu\/web\/2017\/08\/28\/remove-periods-from-degrees\/","title":{"rendered":"Remove Periods from Degrees"},"content":{"rendered":"<p>For example, replace J.D. or L.L.M to JD or LLM.<\/p>\n<p>Here&#8217;s the JavaScript method:<\/p>\n<p><code>&lt;script&gt;<br \/>\nfunction removePeriods() {<br \/>\n    var str = document.getElementById(&quot;c_degrees&quot;).innerHTML;<br \/>\n    var res = str.replace(\/\\.\/g, &quot;&quot;);<br \/>\n    document.getElementById(&quot;c_degrees&quot;).innerHTML = res;<br \/>\n}<br \/>\nwindow.onload = removePeriods;<br \/>\n&lt;\/script&gt;<\/code><\/p>\n<p>To do it in MODX, create a chunk called <code>FixDegrees<\/code>:<\/p>\n<p><code>A.B.:AB,A.M.:AM,B.A.:BA,B.B.A.:BBA,B.C.:BC,B.Com.:BCom,B.E.E.:BEE,B.I.E.:BIE,B.F.A.,BFA:B.L.:BL,B.M.:BM,B.M.E.:BME,B.S.:BS,B.S.E.:BSE,B.S.E.E.:BSEE,D.Jur.:DJur,D.O.:DO,J.D.:JD,J.S.D.:JSD,J.S.P.:JSP,Ed.D.:EdD,Ed.S.:EdS,LL.B.:LLB,LL.D.:LLD,LL.L.:LLL,LL.M.:LLM,M.A.:MA,M.A.S.:MAS,M.B.A.:MBA,M.Ed:MEd,M.Fc.:MFc,M.L.I.S.:MLIS,M.L.S.:MLS,M.D.:MD,M.Ed.:MEd,M.S.:MS,M.Sc.:MSc,M.S.E.E.:MSEE,M.S.L.S.:MSLS,M.T.:MT,P.G.C.E.:PGCE,Ph.D.:PhD,Cert. of Legal Educ.:Cert of Legal Educ,M.P.P.:MPP,S.J.D.:SLD<\/code><\/p>\n<p>Than create a snippet called <code>ReplaceDegrees<\/code>:<\/p>\n<p><code>&lt;?php<br \/>\n$find = array();<br \/>\n$replace = array();<\/p>\n<p>$line = $modx-&gt;getChunk('FixDegrees');<br \/>\n$pairs = array_map('trim', explode(',', $line));<br \/>\nforeach($pairs as $pair) {<br \/>\n    if (strpos($pair, ':') === false) {<br \/>\n        $pair = $pair . ':';<br \/>\n    }<br \/>\n    $couple = array_map('trim', explode(':', $pair));<br \/>\n    $find[] = $couple[0];<br \/>\n    $replace[] = $couple[1];<br \/>\n}<br \/>\nreturn str_replace($find, $replace , $input);<\/code><\/p>\n<p>Call the snippet in the template:<\/p>\n<p><code>[[*bio:ReplaceDegrees]]<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For example, replace J.D. or L.L.M to JD or LLM. Here&#8217;s the JavaScript method: &lt;script&gt; function removePeriods() { var str = document.getElementById(&quot;c_degrees&quot;).innerHTML; var res = str.replace(\/\\.\/g, &quot;&quot;); document.getElementById(&quot;c_degrees&quot;).innerHTML = res; } window.onload = removePeriods; &lt;\/script&gt; To do it in MODX, create a chunk called FixDegrees: A.B.:AB,A.M.:AM,B.A.:BA,B.B.A.:BBA,B.C.:BC,B.Com.:BCom,B.E.E.:BEE,B.I.E.:BIE,B.F.A.,BFA:B.L.:BL,B.M.:BM,B.M.E.:BME,B.S.:BS,B.S.E.:BSE,B.S.E.E.:BSEE,D.Jur.:DJur,D.O.:DO,J.D.:JD,J.S.D.:JSD,J.S.P.:JSP,Ed.D.:EdD,Ed.S.:EdS,LL.B.:LLB,LL.D.:LLD,LL.L.:LLL,LL.M.:LLM,M.A.:MA,M.A.S.:MAS,M.B.A.:MBA,M.Ed:MEd,M.Fc.:MFc,M.L.I.S.:MLIS,M.L.S.:MLS,M.D.:MD,M.Ed.:MEd,M.S.:MS,M.Sc.:MSc,M.S.E.E.:MSEE,M.S.L.S.:MSLS,M.T.:MT,P.G.C.E.:PGCE,Ph.D.:PhD,Cert. of Legal Educ.:Cert of Legal Educ,M.P.P.:MPP,S.J.D.:SLD Than create a &hellip; <a href=\"https:\/\/sls.gmu.edu\/web\/2017\/08\/28\/remove-periods-from-degrees\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Remove Periods from Degrees&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-704","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/posts\/704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/comments?post=704"}],"version-history":[{"count":0,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/posts\/704\/revisions"}],"wp:attachment":[{"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/media?parent=704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/categories?post=704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sls.gmu.edu\/web\/wp-json\/wp\/v2\/tags?post=704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}