2014-06-23 2 views
1

저는 Google이이 코드의 자바 스크립트 버전을 Google 사이트에서 실행하는 것을 허용하지 않는다고 확신합니다 ....이 코드는 appscript에서 가능합니까? 어떤 변화가 필요합니까? 코드 : http://jsfiddle.net/E8SyF/이 스크립트는 Google 사이트에서 실행할 수 있습니까? appscript로 변환 하시겠습니까?

var links = ["http://www.google.com/", "http://www.cnn.com/", "http://www.bbc.com/", "http://www.nbc.com/"]; 
var visited = []; 
var button = document.getElementById('btn'); 
window.onload = function() { 
    if (localStorage.clickcount >= 3) { 
     document.getElementById('btn').className = 'maxques'; 
    } 
}; 
button.addEventListener('click', function() { 
    if (typeof (Storage) !== "undefined") { 
     if (localStorage.clickcount) { 
      localStorage.clickcount = Number(localStorage.clickcount) + 1; 
     } else { 
      localStorage.clickcount = 0; 
     } 
     if (localStorage.clickcount == 2) { 
      document.getElementById('btn').className = 'maxques'; 
     } 
     if (localStorage.clickcount >= 3) { 
      document.getElementById('btn').className = 'maxques'; 
      console.log(localStorage.clickcount); 
      alert('You have completed this category'); 
      return; 
     } 
    } 
    if (visited.length == 2) { 
     document.getElementById('btn').className = 'maxques'; 
    } 
    if (visited.length == 3) { 
     alert('You have completed this category'); 
     return; 
    } 
    var random, url; 

    do { 
     random = Math.floor(Math.random() * 4); 
     url = links[random]; 
    } while (contains(visited, url)); 
    alert('Opening: ' + 'question ' + '#' + random); 
    visited.push(url); 

    var win = window.open(url, '_blank', "height=800,width=800"); 
    win.focus(); 
}); 

function contains(array, value) { 
    for (var i = 0; i < array.length; i++) { 
     if (array[i] == value) return true; 
    } 
    return false; 
} 
+0

을 파이썬을 설치 당신이 발생하는 문제 애플 리케이션의 당신이 쓴 스크립트를 게시해야합니다. –

+0

이것은 자바 스크립트입니다. 나는 Google 사이트에서 그것을 실행하는 방법이나 App Script와 동일한 것을 알고 싶다. – Lillz

+0

닫히기 전에 이전 조언을 따르십시오. –

답변