How to overwrite clipboard every five seconds? - clipboard

I'm trying to prevent users to copy some sensitive data from my internal portal. I have disabled copy paste everything, but I cant disable print screen so I decided to empty clipboard every five seconds so that contents copied will be useless but cant use zeroclipboard.swf without a button trigger
Here is the code
<script>
setInterval ("doSomething()", 1000);
function doSomething()
{
document.getElementById("btn_copy").click();
}
$(document).ready(function(){
$(".cop").zclip({
path:"ZeroClipboard.swf",
copy:"This is arasu"
});
});
If I click the button it works, but it isn't working, when it is triggered with coding
Thanks in advance.

Screw that. I didn't see that it was in html.
However you know that you are just increasing the difficulty of taking snapshots since programs like snagit don't need the clipboard to take screenshots.

Related

How do I pause or continue a page animation when going to another tab in the browser?

I don't code so asking for help :-) Hi, I have an issue for a page animation with a couple of interactions. How do I insert a code snippet to tell the browser to either continue or pause the animation, when a user opens/clicks another tab.
Right now, the animation pauses for the first part, but the subsequent interactions keep going. And it's a jumbled mess.
What is the easiest/simple way to do this? Can someone share the full/complete code snippet to accomplish this? I've been searching for hours and can't seem to find the right solution.
I'm using Webflow for the site. Thanks a bunch.
When the user clicks away from a window, certain events are fired off. You can add event handlers to your window object that respond to these events.
You probably want to listen for 'focus' and 'blur' events. JavaScript:
window.addEventListener('blur', function (evt) {
// turn off your animation here
});
window.addEventListener('focus', function (evt) {
// turn on your animation here
});
Documentation on window blur event, window focus event, addEventListener().
I have a simple page that reports all window events, it might be useful:
https://terrymorse.com/coding/windowevents/index.html

Disable PHP autocomplete suggestions in Sublime Text 3

I program php in Laravel and don't use the myriad of native php functions hardly ever. So I don't need the huge list of php functions that are irrelevant to me to pop up all the time as auto-complete suggestions.
I want my own snippets (which are really useful and cool) to appear but nothing else.
Tried in user/preferences "auto_complete": false
All that does is stop the box from showing on the screen, but the suggestions are still present and will be triggered. I want to switch them off completely, except my own snippets.
The potential of custom snippets to generate oft. used code is wonderful. Would like to add more.
But need to remove the above unnnecessaries first so it's not constantly triggering nonsense that just has to be deleted, interrupting flow. How?
You can add delay timer for auto complete with:
"auto_complete_delay": number in miliseconds
So it will delay for auto complete trigger. This way you will hardly see it if you give it something like 2-3 minutes.

How do I activate the TOC button in an Cocoa Help file?

I am building my first help file and so far all is working except one thing:
There is a Table of contents button in the help browser that is deactivated for my help (and so far all 3rd Party help I looked at).
However it's used in most Apple Apps. It allows you to hide reveal a navigation on the left side of the help page.
I found no documentation about this at all. So I wondered if anyone has figured out how to address this.
Thanks!
Taken from https://gist.github.com/mattshepherd/54c66d38be90c2b1acf0
// Disable TOC button
window.HelpViewer.showTOCButton(false);
// Enable TOC button
// If you call this on window load it will flash active for a brief second
// and then disable again. Call if after a delay of 250ms and is works fine
// Not sure what the second variable does yet, but passing false works fine
window.HelpViewer.showTOCButton( true, false, function() {
//do something to toggle TOC in your webpage
});
// Apple stores the status of the TOC using a window session variable,
// you can use this to keep the TOC open or closed when transitioning
// between pages.
window.sessionStorage.getItem("toc");

Need to Click Popup with Gm script that is not always there

i'm still having a problem clicking a popup button on an auction site,that appears only if u won an auction. This popup seems tbe a problem. Ive managed to get help partially in Need to click a bid button with Grease monkey script, i'm able to get the bid buttons clicked, but the popu is stil a problem. The xpath for the popup is:
.//*[#id='ctl00_mainContentPlaceholder_Button3']
And the script i'm using currently is:
// ==UserScript==
// #name click popup try1.3
// #include http://www.trada.net/*
// ==/UserScript==
// ctl00_mainContentPlaceholder_Button3
function PopClick ()
{var PopBtn1=document.getElementById("ctl00_mainContentPlaceholder_Button3");
alert('try1');
PopBtn1.click (1);
alert('finished');
};
PopClick();
But the problem seems to be that the script doesnt stay active on the page waiting for the popup, I think if i can get it to "wait" for the popup to appear, it should work. I'm very new to GM, so excuse if there is simple errors. I had exelent help from people like Brock sofar, who is showing me the ropes. Slowly but surely I'm gettin the hang of it. Remove the alerts, i just used them to see if it executing.
The simplest solution would be to run this function, say every second, thus "waiting" for the popup to appear:
setInterval(PopClick, 1000);
It is also better to rewrite PopClick to check if the element is there, before calling click, like this:
function PopClick () {
var PopBtn1=document.getElementById("ctl00_mainContentPlaceholder_Button3");
if(PopBtn1) {
PopBtn1.click ();
// It is also makes sense to clear interval here. see docs for setInterval/clearInterval please :)
}
};
May be this will help you with the freezing issue.
The more proper way, however, would be to set up MutationEvent listener. Since you are using Firefox, it should work OK:
function click_if_popup(evt) {
if(evt.target.hasAttribute('id') && evt.target.getAttrubute('id') =="ctl00_mainContentPlaceholder_Button3")
evt.target.click();
}
document.addEventListener('DOMNodeInsertedIntoDocument', click_if_popup);
Sorry, I didn't test any of this code: I wanted just to give you the general idea of where to dig.

Best UI to be shown to User while his request is still in process behind the scenes?

I am currently involved with an Application where I need to design the UI part of the Application and current I am in the process of implementation of UI which would be displayed to end user while his or her request is being processed behind the scenes.
So my question is that:
What is the best UI approach/symbol/suggestions to be displayed to end User while his or her request is still being processed behind the scenes ?
Thanks.
Any sort of throbber is adequate enough. Here's a nice throbber generator you can use.
And there's nothing wrong with progress bars, unless there the kind of progress bars that start over without actually indicating progress.
If you don't take your program too seriously, this one is always a crowd pleaser:
This is going to take a while, so to pass the time, here's a dancing bunny:
http://img251.imageshack.us/img251/4828/thdancingbunny.gif
A Loading screen of some sort may work.
It depends on how long your user must wait. If it will be <10 seconds, then just show the spinning pie of death as an animated GIF (or flash if you prefer to be non-accessible) (a simple jquery hide/show with CSS)
If it is a longer wait, like >10 seconds, you may want to implement a short but entertaining caption system. Something like the old "Reticulating Splines" type system to give the users a bit of humor while they wait.. see https://stackoverflow.com/questions/182112/what-are-some-funny-loading-statements-to-keep-users-amused for a list of such statements.
If you've got a long running background process, I'd simply display a progress bar with a message below it that states in the least technical terms possible what the current task is. And then, if possible, a cancel button in case the user gets impatient or mistakenly started the process.
I can't provide any specific links to back me up, but I believe its been proven that just the presence of a progress bar can make a longer task seem shorter than a task without the progress bar.
The worst thing you can do is nothing. Users have been conditioned to think that no feedback = locked up program.
Note on typical implementation (that I use):
jQuery has the .ajax function. When I call the function (onClick or whatever) I .remove() the contents of the (div or whatever seems appropriate) and add a css class of waiting which looks like:
.waiting {
background-color: #eee;
background-image: url('some-spinner.png');
}
the .ajax function has a success callback where I remove the .waiting class and put in the new data I got back from ajax (or put back the data I took out with .remove().
Additionally you may change default mouse cursor to wait or progress states with CSS.
Details about changing cursor with CSS here.

Resources