Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Justpaste
Search
Shume
April 25, 2013
Programming
0
300
Justpaste
A convenient image uploader
Shume
April 25, 2013
Tweet
Share
More Decks by Shume
See All by Shume
Git
ciffel
2
550
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
620
Claude CodeによるAI駆動開発の実践 〜そこから見えてきたこれからのプログラミング〜
iriikeita
0
330
なんでRustの環境構築してないのにRust製のツールが動くの? / Why Do Rust-Based Tools Run Without a Rust Environment?
ssssota
14
46k
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
250
マンガアプリViewerの大画面対応を考える
kk__777
0
250
開発組織の戦略的な役割と 設計スキル向上の効果
masuda220
PRO
9
1.5k
Cursorハンズオン実践!
eltociear
2
1.2k
はじめてのDSPy - 言語モデルを『プロンプト』ではなく『プログラミング』するための仕組み
masahiro_nishimi
4
15k
Go言語の特性を活かした公式MCP SDKの設計
hond0413
2
510
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
240
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
3
970
その面倒な作業、「Dart」にやらせませんか? Flutter開発者のための業務効率化
yordgenome03
1
140
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
Music & Morning Musume
bryan
46
6.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Code Review Best Practice
trishagee
72
19k
The Language of Interfaces
destraynor
162
25k
Git: the NoSQL Database
bkeepers
PRO
431
66k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
Speed Design
sergeychernyshev
32
1.2k
Embracing the Ebb and Flow
colly
88
4.9k
Designing for Performance
lara
610
69k
Side Projects
sachag
455
43k
Transcript
Justpaste A convenient image uploader http://justpaste.shume.in Shu-Ming Chang @ CNA
micro conf.
Who am I • Shu-Ming Chang (ciffel) • Full time
student at NTHU CSIE • CCU alumnus • Love web development and ruby • But work with Python... • Hate duplication (DRY)
今天要分享的是 JavaScript
今天要分享的是萌圖
聊聊圖⽚片分享
以前如何截圖? 1. PrintScreen
以前如何分享截圖? 2. 開啟⼩小畫家
以前如何分享截圖? 3. 貼上
以前如何分享截圖? 4. 存檔
以前如何分享截圖? 5. 上傳
以前如何分享截圖? 6. 取得連結
Why Justpaste • 分享圖⽚片,特別是截圖 • 簡化處理的步驟 • 圖床 (imgur)
Justpaste 1. PrintScreen or Ctrl-C
Justpaste 2. 貼上
Justpaste 3. 取得連結
實況看動畫 Live Demo
實作細節
More Detail • HTML • Canvas • CSS • Bootstrap
• Javascript (jQuery) • DOM traversal • Cross domain AJAX
Clipboard與Browser的 愛恨情仇 • ⼤大多Browser都限制Clipboard的存取權限 • Firefox, Chrome可讀取 • 但不能”寫⼊入” (Read-only)
Chrome讀取Clipboard • Google Chrome • window.Clipboard • window.addEventListener("paste", pasteHandler); •
從event.item[]中可以取得內容
Firefox讀取Clipboard • Mozilla Firefox • <div contenteditable="true"></div> (hide) • 要確保focus在此
• window.addEventListener("paste", pasteHandler); • 在DOM中取得children node (img)
寫⼊入Clipboard • Flash • ZeroClipboard • 但是還是要有click的⾏行為,無法隨⼼心所 欲的寫⼊入
談談圖床吧 • imgur • RESTful API • Free: 1250 uploads
per day • 有⼈人上傳糟糕圖,不會被報警處理
Justpaste純Front-end • 曾經有個Ruby+Sinatra back-end • 現在純JavaScript • Cross domain AJAX呼叫RESTful
API • 需要Server⽀支援 • http://www.html5rocks.com/en/ tutorials/cors/
為什麼要做Web App? • 其實我也做過Native App直到我...... • Web App的好處 • ⽐比較潮
• 不需要安裝 • 版本永遠是最新的
Future Works • Drag and Drop (current working) • Browser
extension • History • Album
Source Code https://github.com/ciffel/justpaste