久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='maot5'></small><noframes id='maot5'>

      <i id='maot5'><tr id='maot5'><dt id='maot5'><q id='maot5'><span id='maot5'><b id='maot5'><form id='maot5'><ins id='maot5'></ins><ul id='maot5'></ul><sub id='maot5'></sub></form><legend id='maot5'></legend><bdo id='maot5'><pre id='maot5'><center id='maot5'></center></pre></bdo></b><th id='maot5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='maot5'><tfoot id='maot5'></tfoot><dl id='maot5'><fieldset id='maot5'></fieldset></dl></div>

      <legend id='maot5'><style id='maot5'><dir id='maot5'><q id='maot5'></q></dir></style></legend>

        <tfoot id='maot5'></tfoot>
          <bdo id='maot5'></bdo><ul id='maot5'></ul>
      1. Javascript 訪問 Disqus 評論文本框?

        Javascript to access Disqus comment textbox?(Javascript 訪問 Disqus 評論文本框?)

          <tfoot id='QFe73'></tfoot>
            <tbody id='QFe73'></tbody>

          <small id='QFe73'></small><noframes id='QFe73'>

            <legend id='QFe73'><style id='QFe73'><dir id='QFe73'><q id='QFe73'></q></dir></style></legend>
              <bdo id='QFe73'></bdo><ul id='QFe73'></ul>
                  <i id='QFe73'><tr id='QFe73'><dt id='QFe73'><q id='QFe73'><span id='QFe73'><b id='QFe73'><form id='QFe73'><ins id='QFe73'></ins><ul id='QFe73'></ul><sub id='QFe73'></sub></form><legend id='QFe73'></legend><bdo id='QFe73'><pre id='QFe73'><center id='QFe73'></center></pre></bdo></b><th id='QFe73'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QFe73'><tfoot id='QFe73'></tfoot><dl id='QFe73'><fieldset id='QFe73'></fieldset></dl></div>

                • 本文介紹了Javascript 訪問 Disqus 評論文本框?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在開發一個瀏覽器擴展程序,它應該允許我訪問文本框中的評論/帖子.現在很多網站都使用 Disqus 作為評論的一種方式,但是當正在輸入文本時,我無法找到訪問 Disqus 評論框的方法(Disqus API 也沒有提供太多信息).

                  I am working on a browser extension which should allow me to access comments/posts inside textboxes. A lot of sites now use Disqus as a way to comment, but I can't figure out a way to access the Disqus comment box (the Disqus API doesn't tell much either) as text is being entered.

                  有人知道訪問它的方法嗎?

                  Anyone know of a way to access it?

                  推薦答案

                  解決這個問題的最好方法是開始分析 Disqus API 如何處理他們的評論系統.此時,您最好的朋友是 Google Chrome 附帶的 Inspector(開發者工具).

                  The best way to figure it out is to begin analyzing how Disqus API does their comment system. Your best friend at this point is the Inspector (Developer Tools) that comes with Google Chrome.

                  當您分析 DOM(右鍵單擊并定位該評論文本區域)時,您會注意到它是一個 iframe.您應該想到,這是對 Discus 域的跨域請求,以獲取該評論框插件的信息.您可以通過查看標簽看到,它有一個指向 domain.disqus.com 的 href,其中 domain 是您正在查看的網站.

                  When you analyze the DOM (right clicking and locating that comment text area), you will notice that it is an iframe. It should come to your mind that it is a cross-origin request to Discus domain to get the information for that comment box plugin. You can see that by looking at the tag, it has a href that points to domain.disqus.com where domain is the website your looking at.

                  例如,當您訪問 TechCrunch 時,iframe 將指向 http://techcrunch.disqus.com注入評論框.

                  For example, when you visit TechCrunch, the iframe will point to http://techcrunch.disqus.com that injects the comment box.

                  您可以使用 Content-Scripts 來讀取和操作這些注入的頁面,因為 Content-Scripts 也可以通過所有框架 manifest 名稱注入 IFrame.!

                  You can use Content-Scripts to read and manipulate those injected pages, because Content-Scripts can inject into IFrames too via all-frames manifest name.!

                  例如,要設置內容腳本,您需要清單文件中的 content_scripts 部分:

                  As an example, to setup a Content-Script, you need the content_scripts portion in the manifest file:

                  "content_scripts": [
                    {
                      "matches": ["http://*/*"],
                      "js": ["cs.js"],
                      "run_at": "document_end",
                      "all_frames": true
                    }
                  

                  然后,在您的 cs.js(內容腳本文件)中,您可以通過搜索給定的 iframe 找到注釋框.

                  Then, within your cs.js (content script file), you find the comment box from searching the given iframe.

                  // We just need to check if the IFrame origin is from discus.com
                  if (location.hostname.indexOf('.disqus.com') != -1) {
                    // Extract the textarea (there must be exactly one)
                    var commentBox = document.querySelector('#comment');
                    if (commentBox) {
                      // Inject some text!
                      commentBox.innerText = 'Google Chrome Injected!';
                    }
                  }
                  

                  最后,你會看到Google Chrome Injected!"的精彩字眼!

                  At the end, you will see the wonderful words "Google Chrome Injected!"

                  希望能夠推動您創建出色的 Chrome 擴展程序 :) 上面的代碼有效,因為我在本地對其進行了測試.

                  Hope that gives you a push creating awesome Chrome Extensions :) The code above works, since I tested it locally.

                  這篇關于Javascript 訪問 Disqus 評論文本框?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                  Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經度)
                  <legend id='j6oiQ'><style id='j6oiQ'><dir id='j6oiQ'><q id='j6oiQ'></q></dir></style></legend>
                    <bdo id='j6oiQ'></bdo><ul id='j6oiQ'></ul>

                        <small id='j6oiQ'></small><noframes id='j6oiQ'>

                            <tbody id='j6oiQ'></tbody>
                        1. <tfoot id='j6oiQ'></tfoot>

                          <i id='j6oiQ'><tr id='j6oiQ'><dt id='j6oiQ'><q id='j6oiQ'><span id='j6oiQ'><b id='j6oiQ'><form id='j6oiQ'><ins id='j6oiQ'></ins><ul id='j6oiQ'></ul><sub id='j6oiQ'></sub></form><legend id='j6oiQ'></legend><bdo id='j6oiQ'><pre id='j6oiQ'><center id='j6oiQ'></center></pre></bdo></b><th id='j6oiQ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='j6oiQ'><tfoot id='j6oiQ'></tfoot><dl id='j6oiQ'><fieldset id='j6oiQ'></fieldset></dl></div>
                            主站蜘蛛池模板: 欧美网站一区 | 乱码av午夜噜噜噜噜动漫 | 久色一区 | 在线看片网站 | 欧美专区在线观看 | 一级二级三级黄色 | 欧美aa在线 | 台湾佬久久 | 国产精品久久久久久久白浊 | 久久网国产 | 精品自拍视频 | www国产成人免费观看视频,深夜成人网 | 操操操av | 最新免费视频 | 精品日韩在线 | 久久一二| 亚洲精品在线免费观看视频 | 国产成人99久久亚洲综合精品 | 国产伦精品一区二区三区精品视频 | 日本三级电影在线看 | 在线观看视频中文字幕 | 中文字幕av网站 | 欧美激情综合色综合啪啪五月 | 中文字幕 欧美 日韩 | 国产精品久久久久久久久久 | 久久99这里只有精品 | 久久99这里只有精品 | 91福利在线观看视频 | 一级片在线观看视频 | 久久久久久国产精品 | 一区二区在线视频 | 国产一级片 | 最新超碰 | 美美女高清毛片视频免费观看 | 电影在线 | 在线一区视频 | 亚洲视频中文字幕 | 韩国av一区二区 | 欧美成人一区二区 | 免费中文字幕日韩欧美 | 欧美888|