Self-Replicating Scammer Spammer - Randomizing Popup Positioning (Chrome) - javascript

Self-Replicating Popup WORKS! However in CHROME the popups just stack on top of each other. WAS looking for assistance on how to make them appear at random positions. Have edited question now that it's solved.
To give you an idea, here is the code I WAS using to make the popup replicate itself (JS only, I don't need to show you how to implement full-page YT videos):
<script type="text/javascript">
window.onload = function(){ window.open("file:///C:/Windows/System32/popup.html", "", "width=300, height=200") }
window.onunload = function(){ window.open("file:///C:/Windows/System32/popup.html", "", "width=300, height=200") }
</script>
The idea is that the popup is just a HTML file hidden in the VM (hence why no JQuery, AJAX, etc).
Finally: I would really appreciate the help. Whoever is the first to post the best solution gets best answer, and shoutout in credits of the released app and future YT videos (demos and DIY tutorials). Also be kind, web dev isn't my strong suit!! Thanks guys.
NOTE ABOUT ANSWER: Syntax has slight mistake at the end (I didn't even notice at first took me about 10 minutes of staring at it scratching my head to notice.
window.open('about://blank', '', 'width=300, height=200, top='+(Math.random()*screen.height)+', left='+(Math.random()*screen.width)+'')
It's exactly the same as the answer supplied by Villa7_ but you missed the [ + ' ' ] in between the two parentheses at the end, and for some reason dreamweaver (I know, leave me alone) kept flagging up a syntax error whenever I added the semicolons...
Thank you though, this was EXACTLY what I was asking for :) for some reason I can't give a vote though, only select your answer. Will give you the shoutouts I promised :) Very simple, love it!

random position:
window.open('about://blank', '', 'width=300,height=200,top='+(Math.random()*screen.height)+',left='+(Math.random()*screen.width));

Related

onclick="$('#id').toggle()" didn't work, need to rewrite for Chrome older versions

I need help with the next issue. In my code, to toggle some fields I'm using
<a onclick="$('#toggledFormId').toggle()" >Presss</a>
and for me everything was fine, but get issue during the test on other computers. Nothing happends, no errors, no alerts, no toggling.
I know that it's because my version of Chrome is the last one, and on the test computers older, but I need to find universal solution.
I tried this
<script>
$('#hrefId').click(function()
{
$('#toggledFormId').toggle();
});
</script>
this
<script>
$('#hrefId').on('click', function(){
$('#toggledFormId').toggle();
});
</script>
both of this variant by using classes(not id) and some other similar, not to comlicated variants, but with no results.
I will be grateful for any suggestion, especially if it works ^_^
There might be various reasons why it won't work on older chrome versions.
You simply made a spelling mistake with your ids => check your spelling and avoid duplicate ids
One or more closing tags in your markup are missing(if so, chrome attempts to
close them and often miserably fails.).
=> check your markup and try again.
Your items are being added dynamically. In this case try:
$( "body" ).on( "click", "#hrefId", function() {
$('#toggledFormId').toggle();
});
Funny, but non of methods that were purposed didn't work untill...
AdBlock and other similar programs do not let the fields open up. Maybe they think that toggle part of the form is spam or something like this, so after they were disabling suggested solutions started work.
Thank you everyone for help.

Potree/three.js cancel measurement

I'm using Potree (https://github.com/potree/potree) for the visualization of a massive point cloud.
I'm starting an area-measurement (Potree.MeasuringTool) which is normally stopped/accepted by a right-click. I'd like to want it to stop at the click of a button. Can someone point me in the right direction which function to call? I'm not that into javascript. Also, a simulation of a right-button click will be accepted by me, although it's maybe not the prettiest solution.
without event :
viewer.measuringTool.sceneMeasurement.remove(viewer.measuringTool.sceneMeasurement.children[viewer.measuringTool.sceneMeasurement.children.length - 1]);
Tried every possible solution/function saying something about cancellation of a measurement. Found out this was just what I needed in potree.js;
viewer.dispatchEvent({
type: "cancel_insertions"
});
Of course, this is only applicable if the measurement is still active.

$ionicScrollDelegate.scrollTop() doesn't allow me to scroll up manually after it scrolls down my list

I have a problem with using $ionicScrollDelegate.scrollTop()
I need to scroll down my book list to appropriate book after going out from the reader. I desided to use $ionicScrollDelegate.scrollTop() for this purpose.
It works, but I cannot scroll up my list manually after that.
Maybe someone knows why it happens.
Here is my code:
$timeout(function(){
var BooksListScroll = $ionicScrollDelegate.$getByHandle('BooksListScroll');
$location.hash("main" + $rootScope.currentBookCode);
BooksListScroll.scrollTop(true);
}, 500);
If you are using android platform to do a test, remove the 'true' value on the function. Ex:
BooksListScroll.scrollTop(true);
to
BooksListScroll.scrollTop();
Do a try.. IOS is working fine with the scroll animation but on android the scroll animation make the view freeze! Weird! :(
UPDATE (SOLUTION):
Okay I found the solution.. It seem we need to set 'jsScrolling: true' instead of by default is 'jsScrolling: false' for android.
Please modified/edit this on 'ionic-angular.js'
Hope it help others :)

jQuery Unslide - Touch doesn't work

I already solved this, and I'm only posting to help others save some time.
I am using unslider for a business website, a website I'm making responsive, so the feature of adding touch support to the slider is appealing. Unfortunately it doesn't work straight out of the box, as the author claims.
UPDATE
The unslider plugin I used, was outdated. I downloaded it from unslider.com where I first found it( it's still an outdated version there), hence I had the difficulties.
If you need to get the latest version, go to: https://github.com/idiot/unslider/
And if you want to see my issue report: https://github.com/idiot/unslider/issues/69
The problem is that the author hasn't updated his project in 4 months, and since then the swipe event has been moved from $.event.swipe to $.event.special.swipe.
The problem occurs in line 108 of the unslider plugin, where it test for the existence of the swipe plugin.
108: if($.event.swipe) {
109: this.el.on('swipeleft', _.prev).on('swiperight', _.next);
Just change it to:
108: if($.event.special.swipe) {
109: this.el.on('swipeleft', _.prev).on('swiperight', _.next);
It's an easy fix, but will take some googling to figure out.
If you want to be sure it will work with earlier versions, you can do this:
108: if($.event.special.swipe || $.event.special.swipe) {
109: this.el.on('swipeleft', _.prev).on('swiperight', _.next);
But I don't recommend that.
Also, the author doesn't mention this, but the swipe plugin page does, you need to include jquery.event.move in addition to jquery.event.swipe in your scripts.
I hope this helped someone :)
To answer the comment below:
Remember to include all files, in the right order, and remember all of them:
<script type="text/javascript" src="/scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/scripts/jquery.event.move.js"></script>
<script type="text/javascript" src="/scripts/jquery.event.swipe.js"></script>
<script type="text/javascript" src="/scripts/unslider.min.js"></script>
This didn't work for me, but after extensive tweaks I got it to work smoothly. I blogged step by step what I did, but not why.
http://frazer.livejournal.com/21898.html
I hope that helps, especially people new to drupal.
In short - I added this to my page and I got responsive movement:
var wrap = jQuery(".slides_wrap"),
slides = wrap.find(".img_slide"),
width = slides.width();
slides
.on("move", function(e) {
// Move slides with the finger
// banner has moved -100% when one slide to the right
var left = 100 * e.deltaX / width;
wrap[0].style.left = parseInt(wrap[0].style.left.replace("%", ""))+left+"%";
})
.on("moveend", function(e) {
setTimeout(function(){
var left = parseFloat(wrap[0].style.left.replace("%", ""));
var left_rounded = Math.round(left/100)*100;
if(left%100!=0){
jQuery(".slides_wrap").animate({"left":left_rounded + "%"});
}
},800);
});
As of today (November 2014) it seems the swipe functionality was replaced by move. The plugin's url is http://stephband.info/jquery.event.move/ . Just import this one instead of swipe.
I hope someone find this useful. Had to check the commits to found out.
I am bumping on this subject as I am a real noob and had trouble to install the Jquery.event.swipe.js module
It's now solved, but here a few things noobs like me would make sure to check :
make sure you have both github.com/stephband/jquery.event.move.js and github.com/stephband/jquery.event.swipe.js in your projet folder
make a reference to those 2 files in your html file
make sure you have the unslider.js file in your projet folder as well (I had the unslider.min.js file instead which wasn't complete enough to make the swipe plugins work)
No extra javascript code is necessary in the html file, it should work with the above (at least it did for me)
both very good free tools, thanks to the coders

Firefox- Extension - How to make a sidebar

Can anybody tell me how to make a sidebar. There is nothing about sidebar in the XUL reference. I referred some old codes. But, I can't get where to edit. In those codes I have to create jar files frequently which annoys a lot. Can anybody show me a guidance, just a simple code to add a listbox in sidebar?
Edit:
This code works. I edited the code in "emptysidebar.xul". But it didn't work.
Any solution to add elements in sidebar is welcomed.
I didnt even dreamt that the solution will be this much simple. This is the solution.
var sidebarWindow = document.getElementById("sidebar").contentWindow;
if(sidebarWindow)
{
sidebarWindow.location = "chrome://custombutton/content/login.xul";
// your xul location
}
else
{
alert("sidebar window is not null");
}

Categories

Resources