2016-11-13 48 views
1

嗨我想將紅泡代碼嵌入到我的網站爲客戶端(他的紅色泡沫存儲)到joomla網站,並且腳本有問題。Javascript錯誤嵌入redbubble

<script type="text/javascript" src="http://www.redbubble.com/assets/external_portfolio.js"></script> 
 
<script id="rb-xzfcxvzx" type="text/javascript">new RBExternalPortfolio('www.redbubble.com', 'classiceggshell', 5, 5).renderIframe();</script>

它包括的回報,當我檢查它在Chrome我測試腳本上的JSLint它給了我這八個警告devtools 預期的標識符,而是看到「404錯誤的鏈接<'。 預期分配或函數調用,而是看到一個表達式。 缺少分號。 預期分配或函數調用,而是看到一個表達式。 缺少分號。 缺少分號。 未公開的正則表達式。 不可恢復的語法錯誤。 (85%掃描)。

所以,有什麼根本上錯誤的代碼,任何人都可以解決這個問題,並給我正確的代碼連接到他的商店。我試圖加載到他的商店的鏈接到一個Iframe中,但我認爲redbubble在iframe上有一個塊,因爲iframe不會加載並且有一個X-Frame-Options:SAMEORIGIN錯誤。

我試圖講爲redbubble的支持和他們仍然沒有回到我

回信時,雖然我有一定的瞭解,並可以按照分步說明我很少請注意像通常這樣的事情編碼知識很簡單。

+0

檢查文檔..您腳本標記的src'上引用的腳本不存在..'http:// www.redbubble.com/assets/external_portfolio.js' – sa77

回答

1

好吧,我有同樣的問題,由於某些原因,劇本是不存在的,但我能找到它:

RBExternalPortfolio = function(t, e, n, i) { 
    var a = this; 
    a.domain = t, a.rows = n, a.columns = i, a.user_name = e, a.getHeight = function() { 
     return 222 * a.rows + 85 
    }, a.getWidth = function() { 
     return 240 * a.columns + 26 
    }, a.getSrc = function() { 
     return "http://" + a.domain + "/people/" + a.user_name + "/external-portfolio?count=" + a.rows * a.columns 
    }, a.createIframe = function() { 
     var t = document.createElement("iframe"); 
     return t.src = a.getSrc(), t.width = a.getWidth(), t.height = a.getHeight(), t.frameBorder = 0, t.scrolling = "no", t.setAttribute("allowtransparency", "true"), t 
    }, a.renderIframe = function() { 
     var t = document.getElementById("rb-xzfcxvzx"); 
     t.parentNode.replaceChild(a.createIframe(), t) 
    } 
}; 

來源:http://nerdyjs.com/script/1406714

我然後將其保存在本地副本,改變了getSrc行硬編碼點我對開,像這樣:

return "http://redbubble.com/people/<yourname>/external-portfolio?count=" + a.rows * a.columns 

它吮吸,他們沒有固定的它尚未但代碼至少就在那裏!