U E D R , A S I H C RSS

Plugin/Chrome/네이버사전


2. 로그램 목


  • Plug-in 다 extension program라고 는것 같데 뭐 게 만들 는것 같다. 논문 보는데 기능 다.. 난다=ㅂ= 그래 .json는것 같만 문법 고 CSS HTML. DOM 것 같다. 그래 를 긁 HTML element Naver 는 Plug-in 만들볼까 다.

3.

4. 로그램


4.1. 꼭 봐다고 는 것


  • Chrome extention overview
    1. Overview
    2. Tutorial (getstarted) with fileset(manifest.json,.js,.html)
    3. manifest.json attribute.
    4. Contents policy security. 기능 는데 꼭

4.2.


4.2.1. 기본기


개발 API 는데 맨 code가 developer로 는것 같다. index 는 다과 같다.


Tutorial 면 다과 같다.


그런데 떻게 보냐면

Chrome브라 () -> 구 -> 로그램 -> 단 개발 모드 Check -> 로그램 로드면 내 러그 다.

4.2.2. 따라보기


flickr permission 러그 만드는것 같다. HTML 는 CSS. AJAX, Javascript를 (AJAX 겠다 ) 내다. json 가. 미롭군.


로 보는게 더 만 난 라. 료를 때 그 는 문데 javascript구문 다. xml보다 web 기 때문 web 다고 다. .


Ajax는 동기로 데 (A는 Asyncronous) HTML과 CSS 동 DOM문를 가 XML, json만 Ajax를 뜻는 것 동기 기법다.

기까 리 됬나.

따라.

  • 따라다가 : manifest.json menifest.json update가 됨. json때 다 element를 , 를 붙는데 러. 그렇만 나머는 복붙 .

4.2.2.1.


  • popup.js




// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

var req = new XMLHttpRequest();
req.open(
    "GET",
    "http://api.flickr.com/services/rest/?" +
        "method=flickr.photos.search&" +
        "api_key=90485e931f687a9b9c2a66bf58a3861a&" +
        "text=hello%20world&" +
        "safe_search=1&" +  // 1 is "safe"
        "content_type=1&" +  // 1 is "photos only"
        "sort=relevance&" +  // another good one is "interestingness-desc"
        "per_page=20",
    true);
req.onload = showPhotos;
req.send(null);

function showPhotos() {
  var photos = req.responseXML.getElementsByTagName("photo");

  for (var i = 0, photo; photo = photos[i]; i++) {
    var img = document.createElement("image");
    img.src = constructImageURL(photo);
    document.body.appendChild(img);
  }
}

// See: http://www.flickr.com/services/api/misc.urls.html
function constructImageURL(photo) {
  return "http://farm" + photo.getAttribute("farm") +
      ".static.flickr.com/" + photo.getAttribute("server") +
      "/" + photo.getAttribute("id") +
      "_" + photo.getAttribute("secret") +
      "_s.jpg";
}


  • popup.html




<!doctype html>
<html>
  <head>
    <title>Getting Started Extension's Popup</title>
    <style>
      body {
        min-width:357px;
        overflow-x:hidden;
      }

      img {
        margin:5px;
        border:2px solid black;
        vertical-align:middle;
        width:75px;
        height:75px;
      }
    </style>

    <!-- JavaScript and HTML must be in separate files for security. -->
    <script src="popup.js"></script>
  </head>
  <body>
  </body>
</html>

  • manifest.json



{
  "name": "My First Extension",
  "version": "1.0",
  "manifest_version": 2,
  "description": "The first extension that I made.",
  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "permissions": [
    "http://api.flickr.com/"
  ]
}

4.2.3. 내가 는것


  • 리고 몇나면 Text를 - 3
  • 를 더블 리면 - 1

4.2.3.1. 기 구


  • window.open body를 더블 다.

  • index.html

    <html>
    <head>
    <script language="javascript">
    <!--
    function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, 
    
    scrollbar, resizable)
    {
      toolbar_str = toolbar ? 'yes' : 'no';
      menubar_str = menubar ? 'yes' : 'no';
      statusbar_str = statusbar ? 'yes' : 'no';
      scrollbar_str = scrollbar ? 'yes' : 'no';
      resizable_str = resizable ? 'yes' : 'no';
      window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height
    
    +',toolbar='+toolbar_str+',menubar='
    +menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str
    
    +',resizable='+resizable_str);
    }
    
    
    // -->
    </script>
    </head>
    <body ondblclick = "na_open_window('win', 'popup.html', 50, 100, 100, 30, 0, 0, 0, 0, 0)"> 
    
    </body>
    </html>
    

  • na-open_window는 로 만든 데 status_bar나 기 가능 popup 만들고 다. 0 false까.
  • javascript 다른 document.body.ondblclick = 면 똑같 동되는것 다.

  • popup.html

<html>
Hello World!

</html>

4.2.4. Google Chrome extension Sample


4.2.4.1. History 는 extension

  • 격과 공다. 구글 Sample 못되 멨다.


{
  "name" : "BrowsingData API: Basics",
  "version" : "1.1",
  "description" : "A trivial usage example.",
  "permissions": [
    "browsingData"
    
  ],
  "browser_action": {
     "default_icon": "icon.png",
     "default_popup": "popup.html" //게 그냥 popup로 되다. browser_action default_popup  action icon 때 popup 뜬다.
  },
  "manifest_version": 2
}


4.2.4.2. Contents policy security

  • 다.

  • : http://code.google.com/chrome/extensions/contentSecurityPolicy.html

  • inline script를 cross script attack html과 contents를 다고 다. 따르면 inline가는 javascript는 모두 .js로 빼 만들다. <div OnClick="func()"> html inline attach 되기 때문 document 리를 날리던가 element를 document.addEventListener event를 function 결되게 다. . 라는 다.

4.3. 메는 것


  • Chrome extention overview를 는데 다 기능 다. 그 extention 기본는 background.html라는것 는데 extention기능 script를 모두 고 메 밑단 background 가면 나 데 리를 는것 같다. 모르겠다 - 2012/7/3

  • 그래.. 드를 고 permission 다가 manifest.json background를 는것


"background": { "scripts": ["background.js"] },
  "permissions": [
    "tabs", "http://*/*"
  ],




Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:24:00
Processing time 0.0230 sec