{"id":1446,"date":"2022-08-30T15:16:36","date_gmt":"2022-08-30T15:16:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/19\/get-file-from-javascript-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:16:36","modified_gmt":"2022-08-30T15:16:36","slug":"get-file-from-javascript-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/get-file-from-javascript-collection-of-common-programming-errors\/","title":{"rendered":"Get file from javascript-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m not very familiar with js and now I need to do something very important for me, but I really don&#8217;t know how to do it. I&#8217;d like to include google translation api to my site, but I need to change some code in their js files. I have the element.js file on local host:<\/p>\n<pre><code>(function () {\n  var d = window,\n    e = document,\n    f = \".\",\n    g = \"UTF-8\",\n    h = \"complete\",\n    k = \"head\",\n    l = \"link\",\n    m = \"script\",\n    n = \"stylesheet\",\n    p = \"text\/css\",\n    q = \"text\/javascript\";\n  Math.random();\n\n  function r(b) {\n    var a = e.getElementsByTagName(k)[0];\n    a || (a = e.body.parentNode.appendChild(e.createElement(k)));\n    a.appendChild(b)\n  }\n\n  function _loadJs(b) {\n    var a = e.createElement(m);\n    a.type = q;\n    a.charset = g;\n    a.src = b;\n    r(a)\n  }\n\n  function _loadCss(b) {\n    var a = e.createElement(l);\n    a.type = p;\n    a.rel = n;\n    a.charset = g;\n    a.href = b;\n    r(a)\n  }\n\n  function _isNS(b) {\n    b = b.split(f);\n    for (var a = d, c = 0; c &lt; b.length; ++c) if (!(a = a[b[c]])) return !1;\n    return !0\n  }\n\n  function _setupNS(b) {\n    b = b.split(f);\n    for (var a = d, c = 0; c &lt; b.length; ++c) a = a[b[c]] || (a[b[c]] = {});\n    return a\n  }\n  d.addEventListener &amp;&amp; \"undefined\" == typeof e.readyState &amp;&amp; d.addEventListener(\"DOMContentLoaded\",\n\n  function () {\n    e.readyState = h\n  }, !1);\n  if (_isNS('google.translate.Element')) {\n    return\n  }\n  var c = _setupNS('google.translate._const');\n  c._cl = 'en';\n  c._cuc = 'googleSectionalElementInit';\n  c._cac = '';\n  c._cam = '';\n  var h = 'translate.googleapis.com';\n  var b = (window.location.protocol == 'https:' ? 'https:\/\/' : 'http:\/\/') + h;\n  c._pah = h;\n  c._pbi = b + '\/translate_static\/img\/te_bk.gif';\n  c._pci = b + '\/translate_static\/img\/te_ctrl3.gif';\n  c._phf = h + '\/translate_static\/js\/element\/hrs.swf';\n  c._pli = b + '\/translate_static\/img\/loading.gif';\n  c._plla = h + '\/translate_a\/l';\n  c._pmi = b + '\/translate_static\/img\/mini_google.png';\n  c._ps = b + '\/translate_static\/css\/sectionalelement.css';\n  c._puh = 'translate.google.com';\n  _loadCss(c._ps);\n  _loadJs(b + '\/translate_static\/js\/element\/main_se.js');\n})();\n<\/code><\/pre>\n<p>(If it&#8217;s important, link to this file from web page is &#8220;element.js?cb=googleSectionalElementInit&amp;ug=section&amp;hl=en&#8221; )<\/p>\n<p>And I need to get main_se.js (the last link in the file) on localhost too, but I don&#8217;t know how to change link in element.js to this file to make it local. I need it, because I have to replace some html tags in this file to make api work properly for me.<\/p>\n<p>Hope that somebody will advice me what to do.<\/p>\n<ol>\n<li>\n<p>If I understand correctly, <code>elements.js<\/code> produces a<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-19 13:16:50. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m not very familiar with js and now I need to do something very important for me, but I really don&#8217;t know how to do it. I&#8217;d like to include google translation api to my site, but I need to change some code in their js files. I have the element.js file on local host: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1446","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1446"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1446\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}