<commit_before>// We are overriding the single use link javascript to use the Asset path helper instead of just the string 'asset'
//  This can be removed once this PR (https://github.com/projecthydra/sufia/pull/655) has been merged and we are running on the latest sufia.  (after 2.0)
function getSingleUse(id) {
    var rurl = window.location.protocol+"//"+window.location.host;
    var resp = $.ajax({
        headers: { Accept: "application/javascript" },
        type: 'get',
        url: rurl + "/single_use_link/generate_show/" + id.slice(10),
        async: false
    });
    return rurl  + resp.responseText;
}

Blacklight.onLoad(function() {
    ZeroClipboard.setDefaults({ moviePath: "<%= asset_path 'ZeroClipboard.swf' %>" });
    $.each($(".copypaste"), function(idx, item) {
        var clip = new ZeroClipboard();
        clip.on("dataRequested", function(client, args) {
            clip.setText(getSingleUse(this.id));
        })
        clip.on("complete", function(client, args) {
            alert("A single use link to " + args.text + " was copied to your clipboard.")
        })
        clip.on("noflash", function(client, args) {
            $(item).bind('click', function(e) {
                alert("Your single-use link (please copy): " + getSingleUse(item.id));
            } );
        })
        clip.on("wrongflash", function(client, args) {
            $(item).bind('click', function(e) {
                alert("Your single-use link (please copy): " + getSingleUse(item.id));
            } );
        })
        clip.glue($("#" + this.id))
    })
});<commit_msg>Change it to alert once when there is no flash fixes #9570<commit_after>// We are overriding the single use link javascript to use the Asset path helper instead of just the string 'asset'
//  This can be removed once this PR (https://github.com/projecthydra/sufia/pull/655) has been merged and we are running on the latest sufia.  (after 2.0)
function getSingleUse(id) {
    var rurl = window.location.protocol+"//"+window.location.host;
    var resp = $.ajax({
        headers: { Accept: "application/javascript" },
        type: 'get',
        url: rurl + "/single_use_link/generate_show/" + id.slice(10),
        async: false
    });
    return rurl  + resp.responseText;
}

Blacklight.onLoad(function() {
    ZeroClipboard.setDefaults({ moviePath: "<%= asset_path 'ZeroClipboard.swf' %>" });
    var noFlash = false;
    $.each($(".copypaste"), function(idx, item) {
        var clip = new ZeroClipboard();
        clip.on("dataRequested", function(client, args) {
            clip.setText(getSingleUse(this.id));
        })
        clip.on("complete", function(client, args) {
            alert("A single use link to " + args.text + " was copied to your clipboard.")
        })
        clip.on("noflash", function(client, args) {
            noFlash = true;
        })
        clip.on("wrongflash", function(client, args) {
            noFlash = true;
        })
        if (noFlash) return false;
        clip.glue($("#" + this.id))
    });
    if (noFlash) {
      $.each($(".copypaste"), function(idx, item) {
        $(item).click( function(e) {
          alert("Your single-use link (please copy): " + getSingleUse(item.id));
        } );
      });

    }
});
{'fraction_non_alphanumeric': 0.15148727384237964, 'fraction_numerical': 0.005519779208831647, 'mean_word_length': 2.5, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7385865', 'n_tokens_mistral': 1008, 'n_tokens_neox': 960, 'n_words': 255}