Move CDATA to js file

I would like to move this CDATA from HTML source to custom JS file.

Here’s an example of what I’m talking about:

<script type="text/javascript"> /* <![CDATA[ */ var cnArgs = {"ajaxUrl":"https:\/\/www.example.com\/wp-admin\/admin-ajax.php","nonce":"de57d13a7a","hideEffect":"fade","position":"bottom","onScroll":"0","onScrollOffset":"100","onClick":"0","cookieName":"cookie_notice_accepted","cookieTime":"2592000","cookieTimeRejected":"2592000","cookiePath":"\/","cookieDomain":"","redirection":"0","cache":"1","refuse":"1","revokeCookies":"0","revokeCookiesOpt":"automatic","secure":"1","coronabarActive":"0"}; /* ]]> */ </script> 

to…

<script type="text/javascript" src="cdata.js"></script> 

Is it possible to do it like that?

CDATA ta me ferrando

Olá alguem em ajuda com meu script não consigo resolver o erro ja tentei de tudo mas nada funciona.

var script = document.createElement('script'); script.type = "text/javascript"; script.innerHTML = ( < > < ![CDATA[       updateGameLoop = function(a) {         if (player && gameData) {           updateTarget();           if (gameState && mapBounds) {             if (camXS || camYS) camX += camXS * cameraSpd * a, camY += camYS * cameraSpd * a;             player.x + camX < mapBounds[0] ? camX = mapBounds[0] - player.x : player.x + camX > mapBounds[0] + mapBounds[2] && (camX = mapBounds[0] + mapBounds[2] - player.x);             player.y + camY < mapBounds[1] ? camY = mapBounds[1] - player.y : player.y + camY > mapBounds[1] + mapBounds[3] && (camY = mapBounds[1] + mapBounds[3] - player.y);             currentTime - lastCamSend >= sendFrequency && (lastCamX != camX || lastCamY != camY) && (lastCamX = camX, lastCamY = camY, lastCamSend = currentTime, socket.emit("2", Math.round(camX), Math.round(camY)))           }           renderBackground(outerColor);           var d = (player.x || 0) - maxScreenWidth / 2 + camX,             c = (player.y || 0) - maxScreenHeight / 2 + camY;           mapBounds && (mainContext.fillStyle = backgroundColor, mainContext.fillRect(mapBounds[0] - d, mapBounds[1] - c, mapBounds[2], mapBounds[3]));           for (var b, g, e = 0; e < units.length; ++e) b = units[e], b.interpDst && (g = b.interpDst * a * .015, b.interX +=             g * MathCOS(b.interpDir), b.interY += g * MathSIN(b.interpDir), b.interpDst -= g, .1 >= b.interpDst && (b.interpDst = 0, b.interX = b.interpDstS * MathCOS(b.interpDir), b.interY = b.interpDstS * MathSIN(b.interpDir))), b.speed && (updateUnitPosition(b), b.x += b.interX || 0, b.y += b.interY || 0);           var h, f;           if (gameState)             if (activeUnit) {               h = player.x - d + targetDst * MathCOS(targetDir) + camX;               f = player.y - c + targetDst * MathSIN(targetDir) + camY;               var k = UTILS.getDirection(h, f, player.x - d, player.y - c);               0 == activeUnit.type ? (b = UTILS.getDistance(h, f, player.x - d, player.y -                   c), b - activeUnit.size < player.startSize ? (h = player.x - d + (activeUnit.size + player.startSize) * MathCOS(k), f = player.y - c + (activeUnit.size + player.startSize) * MathSIN(k)) : b + activeUnit.size > player.buildRange - .15 && (h = player.x - d + (player.buildRange - activeUnit.size - .15) * MathCOS(k), f = player.y - c + (player.buildRange - activeUnit.size - .15) * MathSIN(k))) : 1 == activeUnit.type || 2 == activeUnit.type ? (h = player.x - d + (activeUnit.size + player.buildRange) * MathCOS(k), f = player.y - c + (activeUnit.size + player.buildRange) * MathSIN(k)) : 3 == activeUnit.type &&                 (b = UTILS.getDistance(h, f, player.x - d, player.y - c), b - activeUnit.size < player.startSize ? (h = player.x - d + (activeUnit.size + player.startSize) * MathCOS(k), f = player.y - c + (activeUnit.size + player.startSize) * MathSIN(k)) : b + activeUnit.size > player.buildRange + 2 * activeUnit.size && (h = player.x - d + (player.buildRange + activeUnit.size) * MathCOS(k), f = player.y - c + (player.buildRange + activeUnit.size) * MathSIN(k)));               activeUnitDir = k;               activeUnitDst = UTILS.getDistance(h, f, player.x - d, player.y - c);               activeUnit.dontPlace = !1;               mainContext.fillStyle =                 outerColor;               if (0 == activeUnit.type || 2 == activeUnit.type || 3 == activeUnit.type)                 for (e = 0; e < units.length; ++e)                   if (1 != units[e].type && units[e].owner == player.sid && 0 <= activeUnit.size + units[e].size - UTILS.getDistance(h, f, units[e].x - d, units[e].y - c)) {                     mainContext.fillStyle = redColor;                     activeUnit.dontPlace = !0;                     break                   }               renderCircle(h, f, activeUnit.range ? activeUnit.range : activeUnit.size + 30, mainContext, !0)             } else if (selUnits.length)             for (e = 0; e < selUnits.length; ++e) mainContext.fillStyle = outerColor, 1 < selUnits.length ? renderCircle(selUnits[e].x -               d, selUnits[e].y - c, selUnits[e].size + 25, mainContext, !0) : renderCircle(selUnits[e].x - d, selUnits[e].y - c, selUnits[e].range ? selUnits[e].range : selUnits[e].size + 25, mainContext, !0);           else activeBase && (mainContext.fillStyle = outerColor, renderCircle(activeBase.x - d, activeBase.y - c, activeBase.size + 50, mainContext, !0));           if (selUnits.length)             for (mainContext.strokeStyle = targetColor, e = 0; e < selUnits.length; ++e) selUnits[e].gatherPoint && renderDottedCircle(selUnits[e].gatherPoint[0] - d, selUnits[e].gatherPoint[1] - c, 30, mainContext);           for (e = 0; e < users.length; ++e)             if (b = users[e], !b.dead) {               mainContext.lineWidth = 1.2 * outlineWidth;               mainContext.strokeStyle = indicatorColor;               isOnScreen(b.x - d, b.y - c, b.buildRange) && (mainContext.save(), mainContext.translate(b.x - d, b.y - c), mainContext.rotate(playerBorderRot), renderDottedCircle(0, 0, b.buildRange, mainContext), renderDottedCircle(0, 0, b.startSize, mainContext), mainContext.restore());               b.spawnProt && (mainContext.strokeStyle = redColor, mainContext.save(), mainContext.translate(b.x - d, b.y - c), mainContext.rotate(playerBorderRot),                 renderDottedCircle(0, 0, b.buildRange + 140, mainContext), mainContext.restore());               for (var m = 0; m < users.length; ++m) e < m && !users[m].dead && (mainContext.strokeStyle = b.spawnProt || users[m].spawnProt ? redColor : indicatorColor, playersLinked(b, users[m]) && (true == true || isOnScreen((b.x + users[m].x) / 2 - d, (b.y + users[m].y) / 2 - c, 0)) && (g = UTILS.getDirection(b.x, b.y, users[m].x, users[m].y), renderDottedLine(b.x - (b.buildRange + lanePad + (b.spawnProt ? 140 : 0)) * MathCOS(g) - d, b.y - (b.buildRange +                 lanePad + (b.spawnProt ? 140 : 0)) * MathSIN(g) - c, users[m].x + (users[m].buildRange + lanePad + (users[m].spawnProt ? 140 : 0)) * MathCOS(g) - d, users[m].y + (users[m].buildRange + lanePad + (users[m].spawnProt ? 140 : 0)) * MathSIN(g) - c, mainContext)))             }           mainContext.strokeStyle = darkColor;           mainContext.lineWidth = 1.2 * outlineWidth;           for (e = 0; e < units.length; ++e) b = units[e], b.layer || (b.onScreen = !1, isOnScreen(b.x - d, b.y - c, b.size) && (b.onScreen = !0, renderUnit(b.x - d, b.y - c, b.dir, b, playerColors[b.color], mainContext)));           for (e = 0; e < units.length; ++e) b = units[e],             1 == b.layer && (b.onScreen = !1, isOnScreen(b.x - d, b.y - c, b.size) && (b.onScreen = !0, renderUnit(b.x - d, b.y - c, b.dir, b, playerColors[b.color], mainContext)));           mainContext.fillStyle = bulletColor;           for (e = bullets.length - 1; 0 <= e; --e) {             b = bullets[e];             if (b.speed && (b.x += b.speed * a * MathCOS(b.dir), b.y += b.speed * a * MathSIN(b.dir), UTILS.getDistance(b.sX, b.sY, b.x, b.y) >= b.range)) {               bullets.splice(e, 1);               continue             }             isOnScreen(b.x - d, b.y - c, b.size) && renderCircle(b.x - d, b.y - c, b.size, mainContext)           }           mainContext.strokeStyle = darkColor;           mainContext.lineWidth =             1.2 * outlineWidth;           for (e = 0; e < users.length; ++e) b = users[e], !b.dead && isOnScreen(b.x - d, b.y - c, b.size) && (renderPlayer(b, b.x - d, b.y - c, mainContext), "unknown" != b.name && (tmpIndx = b.name + "-" + b.size, 20 <= b.size && b.nameSpriteIndx != tmpIndx && (b.nameSpriteIndx = tmpIndx, b.nameSprite = renderText(b.name, b.size / 4)), b.nameSprite && mainContext.drawImage(b.nameSprite, b.x - d - b.nameSprite.width / 2, b.y - c - b.nameSprite.height / 2, b.nameSprite.width, b.nameSprite.height)));           if (selUnits.length)             for (e = selUnits.length - 1; 0 <= e; --e) selUnits[e] &&               0 > units.indexOf(selUnits[e]) && disableSelUnit(e);           activeUnit && renderUnit(h, f, k, activeUnit, playerColors[player.color], mainContext);           showSelector && (mainContext.fillStyle = "rgba(0, 0, 0, 0.1)", h = player.x - d + targetDst * MathCOS(targetDir) + camX, f = player.y - c + targetDst * MathSIN(targetDir) + camY, mainContext.fillRect(mouseStartX, mouseStartY, h - mouseStartX, f - mouseStartY));           playerBorderRot += a / 5600;           hoverUnit ? toggleUnitInfo(hoverUnit) : activeBase ? toggleUnitInfo(activeBase, activeBase.sid == player.sid) : activeUnit ? toggleUnitInfo(activeUnit) :             1 == selUnits.length ? toggleUnitInfo(selUnits[0].info, !0) : toggleUnitInfo()         }       };      ]] > < />).toString();     document.getElementsByTagName('head')[0].appendChild(script);

eu uso o tampermokey como extensão