@blazer05

Не могу запустить инициализировать скрипт?

Всем доброго времени суток.
Есть шаблон с кучей скриптов, задача подключить его на джанго. Вроде все пути к css и js прописал, пути к картинкам исправил. Но скрипт который все это дело выводит не запускается. В логах апача есть ошибки на 8 js файлов, которые лежат в папке scripts.
9398faab4ad7464083f2c8e7f0e9a1d2.png
Вот сам скрипт
<script type="text/javascript">
   // Redirect to phone/tablet as necessary
(function(a,b,c){var d=function(){if(navigator.maxTouchPoints>1)return!0;if(window.matchMedia&&window.matchMedia("(-moz-touch-enabled)").matches)return!0;for(var a=["Webkit","Moz","O","ms","Khtml"],b=0,c=a.length;b<c;b++){var f=a[b]+"MaxTouchPoints";if(f in navigator&&navigator[f])return!0}try{return document.createEvent("TouchEvent"),!0}catch(d){}return!1}(),g=function(a){a+="=";for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var f=b[c];f.charAt(0)==" ";)f=f.substring(1,f.length);if(f.indexOf(a)==
0)return f.substring(a.length,f.length)}return null};if(g("inbrowserediting")!="true"){var f,g=g("devicelock");g=="phone"&&c?f=c:g=="tablet"&&b&&(f=b);if(g!=a&&!f)if(window.matchMedia)window.matchMedia("(max-device-width: 415px)").matches&&c?f=c:window.matchMedia("(max-device-width: 960px)").matches&&b&&d&&(f=b);else{var a=Math.min(screen.width,screen.height)/(window.devicePixelRatio||1),g=window.screen.systemXDPI||0,i=window.screen.systemYDPI||0,g=g>0&&i>0?Math.min(screen.width/g,screen.height/i):
0;(a<=370||g!=0&&g<=3)&&c?f=c:a<=960&&b&&d&&(f=b)}if(f)document.location=f+(document.location.search||"")+(document.location.hash||""),document.write('<style type="text/css">body {visibility:hidden}</style>')}})("desktop","tablet/index.html","phone/index.html");

// Update the 'nojs'/'js' class on the html node
document.documentElement.className = document.documentElement.className.replace(/\bnojs\b/g, 'js');

// Check that all required assets are uploaded and up-to-date
if(typeof Muse == "undefined") window.Muse = {}; window.Muse.assets = {"required":["museutils.js", "museconfig.js", "webpro.js", "musewpslideshow.js", "jquery.museoverlay.js", "touchswipe.js", "jquery.watch.js", "jquery.musepolyfill.bgsize.js", "require.js", "index.css"], "outOfDate":[]};
</script>

Мой измененный вариант
<script type="text/javascript">
   // Redirect to phone/tablet as necessary
(function(a,b,c){var d=function(){if(navigator.maxTouchPoints>1)return!0;if(window.matchMedia&&window.matchMedia("(-moz-touch-enabled)").matches)return!0;for(var a=["Webkit","Moz","O","ms","Khtml"],b=0,c=a.length;b<c;b++){var f=a[b]+"MaxTouchPoints";if(f in navigator&&navigator[f])return!0}try{return document.createEvent("TouchEvent"),!0}catch(d){}return!1}(),g=function(a){a+="=";for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var f=b[c];f.charAt(0)==" ";)f=f.substring(1,f.length);if(f.indexOf(a)==
0)return f.substring(a.length,f.length)}return null};if(g("inbrowserediting")!=="true"){var f,g=g("devicelock");g=="phone"&&c?f=c:g=="tablet"&&b&&(f=b);if(g!==a&&!f)if(window.matchMedia)window.matchMedia("(max-device-width: 415px)").matches&&c?f=c:window.matchMedia("(max-device-width: 960px)").matches&&b&&d&&(f=b);else{var a=Math.min(screen.width,screen.height)/(window.devicePixelRatio||1),g=window.screen.systemXDPI||0,i=window.screen.systemYDPI||0,g=g>0&&i>0?Math.min(screen.width/g,screen.height/i):
0;(a<=370||g!==0&&g<=3)&&c?f=c:a<=960&&b&&d&&(f=b)}if(f)document.location=f+(document.location.search||"")+(document.location.hash||""),document.write('<style type="text/css">body {visibility:hidden}</style>')}})("desktop","tablet/index.html","phone/index.html");

// Update the 'nojs'/'js' class on the html node
document.documentElement.className = document.documentElement.className.replace(/\bnojs\b/g, 'js');

// Check that all required assets are uploaded and up-to-date
if(typeof Muse == "undefined") window.Muse = {}; window.Muse.assets = {"required":["{% static 'colyn/scripts/museutils.js' %}", "{% static 'colyn/scripts/museconfig.js' %}", "{% static 'colyn/scripts/webpro.js' %}", "{% static 'colyn/scripts/musewpslideshow.js' %}", "{% static 'colyn/scripts/jquery.museoverlay.js' %}", "{% static 'colyn/scripts/touchswipe.js' %}", "{% static 'colyn/scripts/jquery.watch.js' %}", "{% static 'colyn/scripts/jquery.musepolyfill.bgsize.js' %}", "{% static 'colyn/scripts/require.js' %}", "{% static 'colyn/css/index.css' %}"], "outOfDate":[]};
</script>

Где моя ошибка? Пробовал к этим файлам по разному достучаться, но результат тот же - ошибка.
  • Вопрос задан
  • 774 просмотра
Решения вопроса 1
fnnzzz
@fnnzzz
front-end dev
рефрешните страничку, нажмите ctrl+U, посмотрите что в итоге аутпутит вам джанга в этом месте

{% static 'colyn/scripts/museutils.js' %}

и подправьте путь, если надо
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы