mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 21:00:10 +01:00
Merge pull request #295 from github/avoid-flash-detection
Remove flash detection
This commit is contained in:
commit
1307353be4
@ -2,14 +2,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
class Choosealicense
|
class Choosealicense
|
||||||
|
|
||||||
# Checks if Flash is available in the client.
|
|
||||||
flashAvailable: ->
|
|
||||||
if ActiveXObject?
|
|
||||||
!!(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))
|
|
||||||
else
|
|
||||||
!!navigator.mimeTypes["application/x-shockwave-flash"]
|
|
||||||
|
|
||||||
# Selects the content of a given element
|
# Selects the content of a given element
|
||||||
selectText: (element) ->
|
selectText: (element) ->
|
||||||
if document.body.createTextRange
|
if document.body.createTextRange
|
||||||
@ -63,7 +55,7 @@ class Choosealicense
|
|||||||
false
|
false
|
||||||
|
|
||||||
# Initializes ZeroClipboard
|
# Initializes ZeroClipboard
|
||||||
initZeroClipboard: ->
|
initClipboard: ->
|
||||||
# Backup the clipboard button's original text.
|
# Backup the clipboard button's original text.
|
||||||
$(".js-clipboard-button").data "clipboard-prompt", $(".js-clipboard-button").text()
|
$(".js-clipboard-button").data "clipboard-prompt", $(".js-clipboard-button").text()
|
||||||
|
|
||||||
@ -72,22 +64,12 @@ class Choosealicense
|
|||||||
moviePath: "/assets/vendor/zeroclipboard/ZeroClipboard.swf"
|
moviePath: "/assets/vendor/zeroclipboard/ZeroClipboard.swf"
|
||||||
clip.on "mouseout", @clipboardMouseout
|
clip.on "mouseout", @clipboardMouseout
|
||||||
clip.on "complete", @clipboardComplete
|
clip.on "complete", @clipboardComplete
|
||||||
clip
|
|
||||||
|
|
||||||
# Initializes an alternative way to copy the license for non-flash compatible
|
# Fallback if flash is not available
|
||||||
# browsers
|
|
||||||
initAlternativeClipboard: ->
|
|
||||||
$(".js-clipboard-button").click (e) =>
|
$(".js-clipboard-button").click (e) =>
|
||||||
target = "#" + $(e.target).data("clipboard-target")
|
target = "#" + $(e.target).data("clipboard-target")
|
||||||
@selectText $(target)[0]
|
@selectText $(target)[0]
|
||||||
|
|
||||||
# if Zero Clipboard is present, bind to button and init
|
|
||||||
initClipboard: ->
|
|
||||||
if ZeroClipboard? && @flashAvailable()
|
|
||||||
@initZeroClipboard()
|
|
||||||
else
|
|
||||||
@initAlternativeClipboard()
|
|
||||||
|
|
||||||
# Callback to restore the clipboard button's original text
|
# Callback to restore the clipboard button's original text
|
||||||
clipboardMouseout: (client, args) ->
|
clipboardMouseout: (client, args) ->
|
||||||
@textContent = $(this).data("clipboard-prompt")
|
@textContent = $(this).data("clipboard-prompt")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user