menucool tooltip javascript purchase pop-up - javascript

I am pretty new to web design and programming. I am trying to learn as much as i can but i have issues with tool tip JavaScript that i used in my website
Here is my website
Does anyone know how to disable the "purchase pop up box"?
This is exactly what i am using
Please help!

For Latest tooltip.JS:
Find below js Code in tooltip.js
e.className = "mcTooltipInner";
Now Find e[P] = h; code, next to upper searched code(in if condition) and replace below code with e[P] = h; code.
$('.mcTooltipWrapper').css('display','none');
/* e[P] = h; */

you just have to find and delete the script after g=new ub; until var c=e(R,k);, so find and delete the script:
if(a)console.log=a}if(E&&E.id=="mcttDummy"&&d.innerHTML.indexOf(X("kdvh#Uh"))!=-1)g.i=function(){};return g},jb=function(d,c,b){b=b||{};var a;for(a in c)d[a]=b[a]!==undefined?b[a]:c[a]},gb=0,I,tb=function(b){if(!b){b=e(o,"mcttDummy");if(!b){b=e(N,"div");b.id="mcttDummy";b[a].display="none";
and it won't show the pop-up again

Open the tooltip.js in Notepad....
Do a search for "mcttDummy", this is the popup that comes up randomly.
You should see a function like this:
if(!b){
b=e(N,"div");
b.id="mcttDummy"
...etc...
}
In that condition where the object is not B,
Put an alert there, that's useful for debuging javascript.
if(!b){alert("mcttDummy");
b=e(N,"div");
b.id="mcttDummy"
...etc...
}
Now try to get the purchase popup to come up.
It should be triggered after the alert.

The tool script relevant portion i.e.
if(a)console.log=a}if(E&&E.id=="mcttDummy"&&d.innerHTML.indexOf(X("kdvh#Uh"))!=-1)g.i=function(){};return g},jb=function(d,c,b){b=b||{};var a;for(a in c)d[a]=b[a]!==undefined?b[a]:c[a]},gb=0,I,tb=function(b){if(!b){b=e(o,"mcttDummy");if(!b){b=e(N,"div");b.id="mcttDummy";b[a].display="none";
May also look like -
if(a)console.log=a}if(k&&k.id=="mcttDummy"&&d[P].indexOf(mb("kdvh#Uh"))!=-1)g.i=Nb;return g},yb=function(d,c,b){b=b||{};var a;for(a in c)d[a]=b[a]!==undefined?b[a]:c[a]},ub=0,M,Jb=function(b){if(!b){b=l(L,"mcttDummy");if(!b){b=l(N,"div");b.id="mcttDummy";b[a][Y]="none";
If you remove the complete script, the script may not function properly. Instead of that, you may simply replace "none" as "". This will solve the issue as I've tested.

Look for this code in js-image-slider.js
for(var b=[],a=0;a<e[d];a++)b[b[d]]
Start this for loop from 24 i.e a=24
The logic is simple.... they iterate the for loop to 24 i.e making the string "slider purchase reminder" count to 24 including spaces.
If you iterate the loop from 24 the string making logic will not work, hence it will not be displayed on the page. So your code snippet should look like
for(var b=[],a=24;a<e[d];a++)b[b[d]]

Related

Remove numbers on a html page using jQuery

I want to make some jQuery actions on a html page :
The page is : http://download.eclipse.org/jetty/stable-9/xref/org/eclipse/jetty/embedded/HelloHandler.html
my aim is to remove the numbers (represented by the class jxr_linenumber)
What I've tried is :
$(".jxr_linenumber").text("")
However google chrome said : Uncaught TypeError: $(...).text is not a function(…)!!
Even more ... when I tried this command $('a'), it returns with one element only ... however the page contains several "a" tags
Here is two screenshots to explain the issue and my goal
The screenshot of the actual page :
My goal = remove the numbers using jquery ... the numbers are in the red box ....
So the result should be as follow :
Any help ? thanks
The .remove() should do the trick, but my guess is that its causing some issues since jquery isnt available on the page, and injecting it after, might be why its only removing one at a time.
You could use plain javascript like this:
var elements = document.getElementsByClassName("jxr_linenumber");
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
Try the Jquery function .remove( ) instead. Something like
$(".jxr_linenumber").remove( );
You use...
$(".jxr_linenumber").html("")
but in the end, the best answer is to use $(".jxr_linenumber").remove() since you don't want empty 'a' tags on your page. That's just bad design.

Count number of times a string of text appears on a page with Javascript

I have a view in an MVC web application that produces and presents a list of countries and the name of their capital cities. Whenever the view loads, if the results presented to the user contain the words 'Australia' one or more times, then I want a message to appear at the bottom of the screen that says 'Australia is included in the results'. I have used the following script, but the message appears whether or not Australia is in the results. Does anyone have any suggestions?
<script type='text/javascript'>
if (
(
document.documentElement.textContent || document.documentElement.innerText
).indexOf('Australia') > -1
) {
alert("Australia is included in the results");
}
</script>
Thanks in advance
Your code looks sensible, so I suspect that the problem is that it is finding the string "Australia" in the code its self!
Try putting this script outside of the page contents (in a separate .js file) and see if the problem persists.
Maybe ;-)
I think only this condition might suffice:
if (document.documentElement.innerText.indexOf('Australia') > -1) {
alert("Australia is included in the results");
}
http://jsfiddle.net/3gkzC/2/
This is actually an answer for your follow up question about using HTML instead of an alert (I can't post comments, so had to do it this way, sorry.)
What you want is document.getElementById("element_ID").innerHTML = "whatever";
See here: http://jsfiddle.net/UVU8w/

Basic Game Using HTML/Javascript

I'm new to coding and have to make a "madlib" game for class. It just needs to be basic. I need the user to fill in 4 words and replace those words for any random ones I choose in a poem or short story. The problem I'm having it that I need the poem/short story to be in the body of web page after it has been "madlibbed".
I'm really not sure how I can take some JavaScript from the head and insert it into the body. Here's what I have so far and I'll try to be specific in what my thoughts/confusions are. Don't worry if there are specific little errors in the code so far, I can figure that out later.
<!doctype html>
<html>
<meta charset="utf-8">
<title>Mad Lib</title>
<script type="text/javascript">
function myFunction()
{ var noun=prompt(“Type a noun here”);
var noun2=prompt(“Type a noun here”);
var verb=prompt(“Type a verb here”);
var verb2=prompt(“Type a verb here”);}</script>
</head><body>
<p>sad indeed, there are other (noun) still freedom from (noun2) no ideas
, from this dryness, freedom from having (verb) as a poet on forced (verb 2)</p>
</body></html>
So basically I'm trying to declare variables in the script and have users enter their answers as a prompt. I'm then trying to take their answers and insert them into the body of the paragraph where I've put (noun) (noun2) (verb) and (verb2). I'm sorry this is so elementary and I can't figure this out. I don't expect you to write the whole code out for me, you can just give me conceptual advice.
Also if you're having problems non-coding related that I might be able to help with I could try to help you with that :D
You could store the text in a variable and use the string replace function to get your content in:
var input = prompt("word");
var text = "My text PLACEHOLDER1";
var newText = text.replace("PLACEHOLDER1", input);
// render text to dom
document.getElementById('myId').innerText = newText;
More advanced would be usage of a regular expression or a template engine.
I don't like giving direct answers when it's obviously for class, so I'll try to point you to a few helpful starting places.
First, you are going to want the user to be able to enter the required verbs, nouns, etc. So, setup a form that has several text inputs.
Next, I would put a button that does a couple things when clicked. First, it would check to make sure none of the text boxes are empty (we want the person to participate, after all). Then, the button will get the input from the user and insert it into the quote where needed. Finally, it will output the whole quote. To do this, I would create a function that, when the user clicks, would write to the p tag something like this:
"sad indeed, there are other " + noun1 + " still freedom from " + noun2 +
"no ideas, from this dryness, freedom from having "...etc.
My final hint: You can update the value of the p tag (I say 'p' because that is what you mentioned earlier. Personally, I would make it a div) if you give it an ID and reference that ID like this: http://www.w3schools.com/jsref/prop_text_value.asp (under more examples, you'll see how to set that to the variables noun1 and noun2).
Leave a comment if you need more hints.

Injecting javascript code into an on click event with javascript and casper.js

I've just started using casperjs after trying to use python (selenium / requests and mechanise) to scrape a page only after some javascript loaded some dynamic content on the page.
Since this was very hard to do or very slow with selenium it was suggested I turn to Casper js (which requires phantomjs).
One thing I am wondering (I am quite new to javascript) is relating to a javascript onclick event.
The page I want to scrape by default shows ten names per page, and at the bottom has options to show (5) or show (100).
After diving into this code and inspecting it with firebug I am wondering if it is possible to change the onclick=loaditems(100) to something like... onclick=loaditems(Load X items), where X could be 200. (or whatever number it needs to be to load all the content on one page and make it easier for scraping. Is this possible?
update
* reviewer asked for the code used to select the 100 items per page....
The code (HTML) is..
<a title="Show 100 items per page"
onclick="lconn.profiles.Friending.setItemsPerPage(this,100)" href="javascript:void(0);">100</a>
and the Xpath is...
/html/body/div/div[2]/div[3]/div[3]/span/div/div/div/div/div[2]/div/div/form/div??/div[4]/div/ul/li[4]/a
problem
I am able to edit the onclick command and change the value to a higher number, however I do not know how to then execute it with the higher number of elements I want to display per page to see if it works.
I used a simple CSS selector for this task. You can change the onclick attribute with string operations. In this case I replace "100" with num. I also added a clickIt argument to click the changed link.
casper.changeItemsPerPageLink = function(num, clickIt){
casper.evaluate(function(num, clickIt){
num = ""+num;
var a = document.querySelector('a[title="Show 100 items per page"]');
a.innerHTML = num;
a.title = a.title.replace("100", num);
a.setAttribute("onclick", a.getAttribute("onclick").replace("100", num));
if (clickIt) {
a.click();
}
}, num, clickIt);
};
See my test code gist.

jQuery function show divs with display: none

I have some jQuery code, which attempts to show the first 6 divs on page load and hide all of the others. It is littered with errors, but ideally I am trying to create a function that shows the next six divs on an event, ultimately when the user scrolls to the bottom. I know my code is not great, but I have done my best to make it as easy to follow as possible.
The code is here, and any help would be much appreciated! Thanks in advance
I think this is what you wanted:
http://jsfiddle.net/gRzPF/8/
If I understand correctly every time you get to the bottom of the window you want to show the next 6 divs. My edit achieves that.
You just needed to use semi-colons in your for statement, wrap a function around it and move your constraintNumber variable inside that function.
replace
for (i = contentNumber, i < constraintNumber, i++;) {
by
for (i = contentNumber; i < constraintNumber; i++) {
in javascript (and C), ; must separate the 3 elements of a for statement
in jsfiddle, you have 'JSLint' button to verify code error !! Use it !
Here http://jsfiddle.net/gRzPF/7/ I modified your code, now it seems to work :)

Categories