* VRFS-1095 fixing copy-to-clipboard for share dialog in native client.

This commit is contained in:
Seth Call 2014-02-13 17:51:51 +00:00
parent 5ba4e97dca
commit 763538e136
4 changed files with 66 additions and 12 deletions

View File

@ -5,3 +5,27 @@ SimpleCov.start do
add_filter "/tmp/"
add_filter "/vendor/"
end
#SimpleCov.coverage_dir 'coverage/'
all_files = Dir['**/*.rb']
base_result = {}
all_files.each do |file|
absolute = File::expand_path(file)
lines = File.readlines(absolute, :encoding => 'UTF-8')
base_result[absolute] = lines.map do |l|
l.strip!
l.empty? || l =~ /^end$/ || l[0] == '#' ? nil : 0
end
end
SimpleCov.at_exit do
coverage_result = Coverage.result
covered_files = coverage_result.keys
covered_files.each do |covered_file|
base_result.delete(covered_file)
end
merged = SimpleCov::Result.new(coverage_result).original_result.merge_resultset(base_result)
result = SimpleCov::Result.new(merged)
result.format!
end

View File

@ -570,6 +570,8 @@
}
function CloseRecording() {}
function OnDownloadAvailable() {}
function SaveToClipboard(text) {}
function IsNativeClient() { return false; }
function SessionLiveBroadcastStart(host, port, mount, sourceUser, sourcePass, preferredClientId, bitrate)
{
@ -711,6 +713,12 @@
this.CloseRecording = CloseRecording;
this.OnDownloadAvailable = OnDownloadAvailable;
// Clipboard
this.SaveToClipboard = SaveToClipboard;
// Capabilities
this.IsNativeClient = IsNativeClient;
// Broadcasting
this.SessionLiveBroadcastStart = SessionLiveBroadcastStart;
this.SessionLiveBroadcastStop = SessionLiveBroadcastStop;

View File

@ -338,14 +338,6 @@
return false;
})
/*
$("#btn-share-copy").zclip({
path: 'zeroclipboard.swf',
copy: function() {
// console.log("copied " + $(".link-contents").text());
return "TEXT";
}
});*/
}
function showDialog() {
@ -463,13 +455,28 @@
}
function afterShow() {
$("#btn-share-copy").clipboard({
if(context.JK.hasFlash()) {
$("#btn-share-copy").clipboard({
path: '/assets/jquery.clipboard.swf',
copy: function() {
// Return text in closest element (useful when you have multiple boxes that can be copied)
return $(".link-contents").text();
// Return text in closest element (useful when you have multiple boxes that can be copied)
return $(".link-contents").text();
}
});
});
}
else {
if(context.jamClient) {
// uses bridge call to ultimately access QClipboard
$("#btn-share-copy").unbind('click').click(function() {
context.jamClient.SaveToClipboard($(".link-contents").text());
return false;
})
}
else {
console.log("no copy-to-clipboard capabilities")
}
}
}
function afterHide() {

View File

@ -479,6 +479,21 @@
}
$item.easyDropDown({nativeTouch: !gon.isNativeClient && gon.global.env != "test"});
})
}
context.JK.hasFlash = function() {
var hasFlash = false;
if(!context.jamClient || !context.jamClient.IsNativeClient()) {
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if(fo) hasFlash = true;
}catch(e){
if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
}
}
return hasFlash;
}