How do I fadeout the current slide in HTML in Codecademy? - html

var main = function() {
$('.dropdown-toggle').click(function() {
$('.dropdown-menu').toggle();
});
$('.arrow-next').click(function() {
var currentSlide = $('.active-slide');
var nextSlide = currentSlide.next();
var currentDot = $('.active-dot');
var nextDot = currentDot.next();
if(nextSlide.length == 0) {
nextSlide = $('.slide').first();
nextDot = $('.dot').first();
}
$('.arrow-prev').click(function() {
var currentSlide = $('.active-slide');
var prevSlide = currentSlide.prev();
if(prevSlide.length==0) {
prevSlide=$('.slide').last();
}
currentSlide.fadeOut(600).removeClass('active-slide');
nextSlide.fadeIn(600).addClass('active-slide');
currentDot.removeClass('active-dot');
nextDot.addClass('active-dot');
});
};
$(document).ready(main);
When I try to submit this code in Codecademy, I get this error: "Try again, remember to fadeout the current slide. I have done exactly what it says in the "hint" section, but it still gives me the same error.

Related

App Maker Document approval template : Add Default Approvers and notify Owner the status automatically

I am studying the document approval template, and added default Approvers successfully by using the code below.
App Maker Document approval template : How can I Add Default Approvers
My question is that after adding these code in app maker, function notifyApproversAboutRequest_(request) still work, but the function notifyOwnerAboutRequestRejected(request) and function notifyOwnerAboutRequestApproved_(request) do not work anymore. Can anyone tell me how to resolve the problem? Thank you!
if (requestDs.item.WorkflowStages.length === 0) {
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'darpan.sanghavi#abc.com';
draft.Name = 'Darpan Sanghavi';
createDatasource.createItem(function(createdRecord) { });
});
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.OrderNo =
getNextOrderNumberForApprover(requestDs.item);
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'darpan.sanghavi#xyz.com';
draft.Name = 'Darn Alarm';
createDatasource.createItem(function(createdRecord) { });
app.closeDialog();
});
}
I was able to resolve with these changes.
Both notifyOwnerAboutRequestRejected(request) and function notifyOwnerAboutRequestApproved_(request) are ok:
if (requestDs.item.WorkflowStages.length === 0) {
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'Test#test.com.br';
draft.Name = 'Test';
createDatasource.createItem(function(createdRecord) { });
});
requestDs.relations.WorkflowStages.createItem(function() {
requestDs.relations.WorkflowStages.item.OrderNo =
getNextOrderNumberForApprover(requestDs.item);
requestDs.relations.WorkflowStages.item.Status = window.Status.Draft;
requestDs.relations.WorkflowStages.item.Type = "All";
var createDatasource =
requestDs.relations.WorkflowStages.relations.Approvers.modes.create;
var draft = createDatasource.item;
draft.Email = 'test2#test.com.br';
draft.Name = 'Test2';
createDatasource.createItem(function(createdRecord) { });
app.closeDialog();
});
} else {
app.closeDialog();
}
},
failure: function() {
app.closeDialog();
}
});
}
Thanks so much for your code, it solved my problem with stages.

Saving data from a Chrome extension

I am trying to create a Chrome extension that looks like the image below.
I want to save the Name and Id when clicking "+" button and I want to load all saved data int the onLoad event as seen in the upper section of image. I would also like to delete a particular row of data when clicking corresponding delete button.
Saved data should persist when closing Chrome.
document.body.onload = function() {
chrome.storage.sync.get(["id","name"], function(items) {
if (!chrome.runtime.error) {
console.log(items);
document.getElementById("lsid").innerText = items.id;
document.getElementById("lsname").innerText = items.name;
}
});
}
document.getElementById("set").onclick = function() {
var d = document.getElementById("name").value;
var x = document.getElementById("id").value;
d=String(d);
chrome.storage.sync.set({"name":d,"id" : x}, function() {
if (chrome.runtime.error) {
console.log("Runtime error.");
}
});
window.close();
}
document.body.onload = function Load() {
for(var i=0;i<localStorage.length;i++){
var row = document.createElement("TR");
var col1 = document.createElement("TD");
var col2 = document.createElement("TD");
var col3 = document.createElement("TD");
var del = document.createElement("BUTTON");
var id=localStorage.key(i);
col1.innerHTML=localStorage.getItem(id);
col2.innerHTML=id;
del.innerHTML="delete";
del.id=id;
del.className ="delete";
col3.appendChild(del);
row.appendChild(col1);
row.appendChild(col2);
document.getElementById("list_table").appendChild(row);
}
}
document.form_save.onsubmit = function() {
var newName = document.form_save.name.value;
var newId = document.form_save.id.value;
window.localStorage.setItem(newId, newName);
location.reload();
}
document.getElementById("list_table").onclick=function(e){
if(e.target.className=="delete"){
var result = confirm("Want to delete?");
if (result) {
window.localStorage.removeItem(e.target.id);
location.reload();
}
}
}

Decode/Encode .swf file

I have this .swf file: http://www.mediafire.com/download/hrr3c6c188jsgvd/upload.swf
I need to change something in this file, so I have this website http://www.showmycode.com/ decode the file and got those code:
if (!hasOwnProperty("_load05626E90")) {
_load05626E90 = true;
telltarget ("..") {
var copyright = function () {
telltarget ("..") {
geturl("http://www.google.com/search?q=PHP+Script+c-Image+Uploader+3.0", "_blank");
}
};
}
}
else {
// unexpected jump
}
var author = function () {
telltarget ("..") {
geturl("http://chiplove.biz", "_blank");
}
};
// unexpected jump
// unexpected jump
var uploadItem = function (num) {
telltarget ("..") {
var item = flash.net.FileReference(list[num]);
item.addlistener(listener2);
item.upload((((((((((("upload.php?watermark=" + watermark) + "&logo=") + logo) + "&resize=") + resize) + "&server=") + server) + "&q=") + q)+ "&account=") + account)+ "&password=") + password);
}
};
// unexpected jump
// unexpected jump
var FileChooser = function () {
telltarget ("..") {
var fileRef = new flash.net.FileReferenceList();
fileRef.addlistener(listener);
fileRef.browse(allTypes);
}
};
// unexpected jump
// unexpected jump
};
stop();
//---------------------------------------------------------------------- //Frame 1 //----------------------------------------------------------------------
this.menu = new contextmenu();
this.menu.hidebuiltinitems();
this.menu.customitems.push(new contextmenuitem("PHP Script - c-Image Uploader 3.0", copyright));
this.menu.customitems.push(new contextmenuitem("Powered by chiplove.9xpro", author));
//---------------------------------------------------------------------- //Symbol 3 Button //----------------------------------------------------------------------
on (press) {
var listener = new object();
var listener2 = new object();
var itemnum = 0;
var numfiles = 0;
delete _global.__resolve;
_global.__resolve = _global.__debugResolve;
if (list == undefined) {
var list = null;
}
var allTypes = new array();
var imageTypes = new object();
imageTypes.description = "Images (*.jpg; *.jpeg; *.jpe; *.gif; *.png;)";
imageTypes.extension = "*.jpg; *.JPG; *.jpeg; *.jpe; *.gif; *.png;";
allTypes.push(imageTypes);
listener.onselect = function (fileRefList) {
list = fileRefList.fileList; numfiles = list.length;
uploadItem(itemnum);
};
listener2.onOpen = function (file) { };
listener2.onProgress = function (file, bytesloaded, bytestotal) {
flash.external.ExternalInterface.call("loading");
};
listener2.onComplete = function (file) { };
listener2.onUploadCompleteData = function (file, data) {
var loadvars = new loadvars();
loadvars.decode(data);
flash.external.ExternalInterface.call("displaypic", file.name, loadvars.image);
itemnum = itemnum + 1;
if (itemnum < numfiles) {
uploadItem(itemnum);
}
else {
flash.external.ExternalInterface.call("responseStatus", "Done!");
}
};
flash.external.ExternalInterface.addCallBack("FileChooser", this, FileChooser);
flash.external.ExternalInterface.call("clearlist");
FileChooser();
}
I think this is Action Script code, so after make some little change I get flash builder to recompile it, however, flash builder show a lot of red underline (syntax error) in my code and can't build those code to .swf file again. I wonder if the code I got from showmycode.com is correct, or is it action script? If the code I got from showmycode.com is not correct, how can I decode, edit, then encode again that "upload.swf" file?

how to create a counter or ticker showing numbers for websites in a slider

How or where can i get a counter something similar to this? I am aware of the sliders but the counter in the slider is something i am looking for and developing the website with HTML5, jquery.
I'm not sure I got the question 100%, anyway, here's my attempt:
JSFiddle
var Counter = function(options) {
var start = options.start;
this.init = function() {
var self = this;
var t = window.setInterval(function() {
start+=1;
self.render(start);
}, options.interval)
}
this.render = function(number) {
var stringVal = number.toString();
var arr = stringVal.split('');
for(var i = 0; i < arr.length ; i++) {
$('.number').eq(i).text(arr[i]);
}
}
this.init();
}
var counter = new Counter({
start: 123456777,
interval: 1000 //milliseconds
});

jquery cookie code error

I tried to create a cookie for the link but it showed me errors like this....how to fix it...
Uncaught ReferenceError: createCookie is not defined
i am providing my code in fiidle
http://jsfiddle.net/SSMX4/82/ cookie not working
my jquery code is below
// locale selector actions
$('#region-picker').click(function(){
if ($("#locale-select").is(":visible")) return closeSelector('slide');
var foot_height = $('#footer').innerHeight();
var foot_height_css = foot_height-1;
var select_position = '-=' + (Number(700)+18);
console.log("hallo"+select_position);
var $selector = $('#locale-select');
$('#locale_pop').fadeOut();
$selector.css({top:foot_height_css});
$selector.fadeIn(function(){
$(this).addClass('open');
$(this).animate({top:select_position}, 1000);
});
});
$('#select-tab').click(function(e){
e.stopPropagation()
closeSelector('slide');
});
// don't hide when clicked within the box
$('#locale-select').click(function(e){
e.stopPropagation();
});
$(document).click(function(){
if ($('#locale-select').hasClass('open')) {
closeSelector('disappear');
}
});
$('.locale-link').click(function(){
//var $clicked = $(this); //"$(this)" and "this" is the clicked span
$(".locale-select-lable").html($(this).html());
//search for "marginXXXXX"
var flags = $(this).attr("class").match(/(margin\w+)\s/g);
//create new class; add matching value if found
var flagClass = "tk-museo-sans locale-select-lable" + (flags.length ? " " + flags[0] : "");
//set new class definition
$(".locale-select-lable").attr("class", flagClass);
closeSelector('disappear');
//if ($("#locale-select").is(":visible")) return closeSelector('slide');
/*
// var desired_locale = $(this).attr('rel');
// createCookie('desired-locale',desired_locale,360);
// createCookie('buy_flow_locale',desired_locale,360);
//closeSelector('disappear');
*/
}); /* CORRECTED */
$('#locale_pop a.close').click(function(){
var show_blip_count = readCookie('show_blip_count');
if (!show_blip_count) {
createCookie('show_blip_count',3,360);
}
else if (show_blip_count < 3 ) {
eraseCookie('show_blip_count');
createCookie('show_blip_count',3,360);
}
$('#locale_pop').slideUp();
return false;
});
function closeSelector(hide_type){
var foot_height = $('#footer').innerHeight();
var select_position = '+=' + (Number(400)+20);
if (hide_type == 'slide') {
$('#locale-select').animate({top:select_position}, 1000, function(){
$(this).removeClass('open');
$(this).fadeOut()
});
}
else if (hide_type == 'disappear'){
$('#locale-select').fadeOut('fast');
$('#locale-select').removeClass('open');
}
}
$('.locale-link').click(function(){
var desired_locale = $(this).attr('rel');
console.log("cookie....." + desired_locale);
createCookie('desired-locale',desired_locale,360);
createCookie('buy_flow_locale',desired_locale,360);
closeSelector('disappear');
})
$('#locale_pop a.close').click(function(){
var show_blip_count = readCookie('show_blip_count');
if (!show_blip_count) {
createCookie('show_blip_count',3,360);
}
else if (show_blip_count < 3 ) {
eraseCookie('show_blip_count');
createCookie('show_blip_count',3,360);
}
$('#locale_pop').slideUp();
return false;
});
​
I did not find your declaration of the function "createCookie". It seems you copied the code and forgot to copy the function.
Btw: "xxx is not defined" always means the variable/function does not exist ..