I cannot integrate js query file in vue - vue.js

i would like to use a js query code that I found on codepen in my vue project, but im not sure How to integrate it .
I simply pasted the file in my created() of my vue component but it doesn seem to work out.. the code is supposing to run a visual animation when typing chinese caractere in the input form.
this is the codepen : https://codepen.io/simeydotme/pen/CFcke
var $input = $('input');
$input.on({
"focus": function(e) {
$(".input-container").addClass("active");
},
"blur": function(e) {
$(".input-container").removeClass("active");
}
});
var previous = null;
setInterval( function() {
if( previous !== $input.val()
|| "" === $input.val()) {
getGoodCharacters( $input );
previous = $input.val();
}
}, 500);
function getGoodCharacters( $this ) {
var output = $this.val().trim();
var letters = output.split("");
var url = "https://service.goodcharacters.com/images/han/$$$.gif";
$(".error-container, .help").removeClass("show");
$(".output-container").empty();
for( letter in letters ) {
var img = letters[letter] + "";
var newurl = url.replace("$$$",img);
loadCharacter( newurl , img );
}
}
function loadCharacter( url , letter ) {
var img = new Image();
var $output = $(".output-container");
var $a = $("<a/>");
var l = $("input").val().length;
var cwidth = "120px";
if( l > 7 ) { cwidth = "70px"; }
else if( l > 6 ) { cwidth = "90px"; }
else if( l > 5 ) { cwidth = "100px"; }
$(img).load(function(){
$a.attr({
"href": url,
"title": "Good Character Chinese Symbol: "+ letter + ""
}).css("width", cwidth ).append( $(this) ).appendTo($output);
$(".help").addClass("show");
}).attr({
src: url
}).error(function(){
$(".error-container").addClass("show");
});
}
var $try = $(".tryme a").on("click", function(e) {
e.preventDefault();
$input.val( $(this).text() );
});
I also imported the jquery module in my componant
import $ from "jquery";
here is the html that i added in the template
<div class="container input-container">
<input type="text" id="input" placeholder="中文" value="中文"/>
</div>
Thanks!

Related

getting the error while copying feature ""Requested type name "feature" is unknown.""

This is code what I wrote for this...
Feature Deep Copy
rally.PortfolioItemDeepCopy = function (rallyDataSource, config) {
var portfolioitemBuffer = [];
var firstPortfolioItem = null;
var firstStory = null;
var finishedCallback;
var that = this;
//dojo.connect(obj, event, context, method, dontFix);
this._fireEvent = function(eventName, eventArgs) {
if (config && config.eventListeners[eventName] && dojo.isFunction(config.eventListeners[eventName])) {
config.eventListeners[eventName](that, eventArgs);
}
};
// removes private and read only fields to keep from pushing them up.
this.filterObject = function (object) {
return object;
};
this._addObject = function(object, typeName, callback) {
var item = dojo.clone(object);
item = this.filterObject(item);
function errorFunctionWrapper(error) {
if (dojo.isArray(error.Errors)) {
var errorMessage = error.Errors.pop();
if (errorMessage.indexOf("Not authorized to create:") >= 0) {
errorMessage = "Unable to create an object. This can happen due to a child or task being in a project you do not have write permissions to.";
}
rally.sdk.ui.AppHeader.showMessage("error", errorMessage, 10000);
}
else if(dojo.isObject(error)&&error.message){
rally.sdk.ui.AppHeader.showMessage("error", error.message, 10000);
error = [error.message];
}
if (dojo.isFunction(config.onError)) {
config.onError(error);
}
}
rallyDataSource.create(typeName, item, callback, errorFunctionWrapper);
};
this._copyAllFromBuffer = function() {
if (portfolioitemBuffer.length > 0) {
var portfolioitem = portfolioitemBuffer.pop();
that._copyPortfolioItem(portfolioitem.ref, portfolioitem.parent, that._copyAllFromBuffer);
}
else {
if (finishedCallback) {
finishedCallback(firstPortfolioItem);
}
}
};
this._addPortfolioItemsToBuffer = function(portfolioitemArray, parentRef) {
dojo.forEach(portfolioitemArray, function (portfolioitem) {
portfolioitemBuffer.push({
ref: portfolioitem._ref,
parent: parentRef
});
});
};
this._copyPortfolioItem = function(ref, parentRef, callback) {
rallyDataSource.getRallyObject(ref, function (foundObject) {
var type = "feature"
that._fireEvent("portfolioitemPreAdd", {portfolioitem:foundObject});
if (parentRef) {
foundObject.Parent = parentRef;
}
else {
foundObject.Name = "(Copy of) " + foundObject.Name;
}
that._addObject(foundObject, type, function (portfolioitemRef) {
if (!firstPortfolioItem) {
firstPortfolioItem = portfolioitemRef;
}
that._fireEvent("portfolioitemPostAdd", {});
that._addPortfolioItemsToBuffer(foundObject.Children, portfolioitemRef);
that._copyStoriesToPortfolioItem(foundObject.Stories, portfolioitemRef, callback);
that._copyTasksToStory(foundObject.Tasks, portfolioitemRef, callback);
}, null);
});
};
this._copyTasksToStory = function(tasks, storyRef, callback) {
//Copy the array
var localTasks = tasks.slice(0);
if (localTasks.length > 0) {
var task = localTasks.pop();
that._copyTask(task._ref, storyRef, function () {
that._copyTasksToStory(localTasks, storyRef, callback);
});
}
else {
callback();
}
};
this._copyStoriesToPortfolioItem = function(stories, portfolioitemRef, callback) {
//Copy the array
var localStories = stories.slice(0);
if (localStories.length > 0) {
var task = localStories.pop();
that._copyStory(story._ref, portfolioitemRef, function () {
that._copyStoriesToPortfolioItem(localStories, portfolioitemRef, callback);
});
}
else {
callback();
}
};
this._copyStory = function(ref, portfolioitemRef, callback) {
rallyDataSource.getRallyObject(ref, function (foundObject) {
var type = "hierarchicalrequirement";
foundObject.WorkProduct = portfolioitemRef;
that._fireEvent("storyPreAdd", {story:foundObject});
that._addObject(foundObject, type, function (ref, warnings) {
if (callback) {
that._fireEvent("storyPostAdd", [ref]);
callback();
}
}, null);
});
};
this._copyTask = function(ref, storyRef, callback) {
alert('helooooddddddddddddd task', ref);
rallyDataSource.getRallyObject(ref, function (foundObject) {
var type = "task";
foundObject.WorkProduct = storyRef;
that._fireEvent("taskPreAdd", {task:foundObject});
that._addObject(foundObject, type, function (ref, warnings) {
if (callback) {
that._fireEvent("taskPostAdd", [ref]);
callback();
}
}, null);
});
};
this.copyPortfolioItem = function (ref, callback) {
alert('hello');
that._copyPortfolioItem(ref, undefined, that._copyAllFromBuffer);
finishedCallback = callback;
};
};
</script>
<style type="text/css">
/* Add app styles here */
</style>
<script type="text/javascript">
rally.addOnLoad(function() {
var selectedValue = null;
var tasksAdded = 0;
var storiesAdded = 0;
var portfolioitemAdded = 0;
var searchPortfolioItem;
var searchStories;
var goButton, chooseButton;
var chooser;
var waiter;
var dataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__',
'__PROJECT_OID__',
'__PROJECT_SCOPING_UP__',
'__PROJECT_SCOPING_DOWN__');
function taskPostAdd(object, args) {
tasksAdded = tasksAdded + 1;
displayTasksAdded(tasksAdded);
}
function taskPreAdd(object, args) {
dojo.byId("currentInfo").innerHTML = "Adding Task " + args.task.FormattedID + " - " + args.task.Name;
}
function storyPreAdd(object, args) {
dojo.byId("currentInfo").innerHTML = "Adding User Story " + args.story.FormattedID + " - " + args.story.Name;
}
function storyPostAdd(object, args) {
storiesAdded = storiesAdded + 1;
displayStoriesAdded(storiesAdded);
}
function displayStoriesAdded(count) {
dojo.byId("storyResult").innerHTML = "Stories added: " + count;
}
function portfolioitemPreAdd(object, args) {
dojo.byId("currentInfo").innerHTML = "Adding PortfolioItem " + args.story.FormattedID + " - " ;
}
function portfolioitemPostAdd(object, args) {
portfolioitemsAdded = portfolioitemsAdded + 1;
displayPortfolioItemsAdded(portfolioitemsAdded);
}
function displayPortfolioItemsAdded(count) {
dojo.byId("portfolioitemResult").innerHTML = "PortfolioItems added: " + count;
}
function displayTasksAdded(count) {
dojo.byId("taskResult").innerHTML = "Tasks added: " + tasksAdded;
}
function portfolioitemCopied(portfolioitem) {
dojo.byId("currentInfo").innerHTML = "Copy complete: ";
var link = new rally.sdk.ui.basic.Link({
item: portfolioitem,
text: portfolioitem._refObjectName
});
link.display('currentInfo');
goButton.setEnabled(true);
chooseButton.setEnabled(true);
if(waiter) {
waiter.hide();
waiter = null;
}
}
function buttonPressed() {
if (selectedValue) {
var config = {
eventListeners:{
portfolioitemPreAdd:portfolioitemPreAdd,
portfolioitemPostAdd:portfolioitemPostAdd,
storyPreAdd:storyPreAdd,
storyPostAdd:storyPostAdd,
taskPreAdd:taskPreAdd,
taskPostAdd:taskPostAdd
}
};
portfolioitemsAdded = 0;
displayPortfolioItemsAdded(portfolioitemsAdded);
tasksAdded = 0;
displayTasksAdded(tasksAdded);
storiesAdded = 0;
displayStoriesAdded(storiesAdded);
dojo.byId("currentInfo").innerHTML = "";
var copy = new rally.PortfolioItemDeepCopy(dataSource, config);
goButton.setEnabled(false);
chooseButton.setEnabled(false);
waiter = new rally.sdk.ui.basic.Wait({});
waiter.display('wait');
copy.copyPortfolioItem(rally.sdk.util.Ref.getRelativeRef(selectedValue), portfolioitemCopied);
}
}
function onChooserClose(chooser, args) {
if (args.selectedItem) {
selectedValue = args.selectedItem;
goButton.setEnabled(true);
dojo.byId('portfolioitemBox').innerHTML = args.selectedItem.FormattedID + ' - ' + args.selectedItem.Name;
}
}
function showChooser() {
var chooserConfig = {
fetch:"FormattedID,Name,Description",
type: "PortfolioItem",
title: "Feature Chooser"
};
chooser = new rally.sdk.ui.Chooser(chooserConfig, dataSource);
chooser.addEventListener('onClose', onChooserClose);
chooser.display();
}
rally.addOnLoad(function () {
goButton = new rally.sdk.ui.basic.Button({
text: "Copy",
enabled: false
});
goButton.addEventListener('onClick', buttonPressed);
goButton.display('goButton');
chooseButton = new rally.sdk.ui.basic.Button({
text: "Choose"
});
chooseButton.addEventListener('onClick', showChooser);
chooseButton.display('chooseButton');
showChooser();
rally.sdk.ui.AppHeader.setHelpTopic("252");
});
});
</script>
</head>
<body>
<div id="container">
<div style="float:left">
<span id="chooseButton"></span>
<span id="portfolioitemBox" style="line-height:18px;vertical-align:middle">[No feature selected]</span>
<span id="goButton"></span>
</div>
<div id="wait" style="float:left; height: 16px; width: 24px;"></div>
<div style="margin-left:5px;padding-top:10px;clear:both">
<div id="currentInfo" style="height:16px"></div>
<div id="portfolioitemResult" style="margin-top:10px"></div>
<div id="storyResult"></div>
<div id="taskResult"></div>
</div>
</div>
</body>
</html>
In WS API there is no object "feature". Please try either portfolioitem/feature or portfolioitem and then filter out by _type, e.g.
if(results.pi[i]._type == "PortfolioItem/Feature"){ //...
as shown here.
Since you are using a legacy AppSDK1 I assume you are setting a version to 1.43 as mentioned in this post.

How to create dropdown list with TestSet names in Rally sdk

I'm trying to create dropdown list with names of TestSets. I need that for filtering purpose.
I have tried with below code:
function dropdownChanged(dropdown, eventArgs) {
var selectedItem = eventArgs.item;
var selectedValue = eventArgs.value;
}
function onLoad() {
var rallyDataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__',
'__PROJECT_OID__',
'__PROJECT_SCOPING_UP__',
'__PROJECT_SCOPING_DOWN__');
var config = {
type : "testset",
attribute : "name"
};
var attributeDropdown = new rally.sdk.ui.AttributeDropdown(config, rallyDataSource);
attributeDropdown.display("aDiv", dropdownChanged);
}
rally.addOnLoad(onLoad);
Can anyone help me with that?
You may use Object Dropdown instead of Attribute Dropdown. In this code test set selection from the attribute dropdown results in a table populated with test cases of the selected test set.
<script type="text/javascript" src="https://rally1.rallydev.com/apps/1.32/sdk.js"></script>
<script type="text/javascript">
var table = null;
function showTable(results) {
var t = " ";
var tableConfig = {
columnKeys : ['Name','FormattedID','TestCases'],
columnHeaders : ['Name','FormattedID','TestCases'],
columnWidths : ['200px','200px', '400px']
};
table = new rally.sdk.ui.Table(tableConfig);
for (var i=0; i < results.ts.length; i++) {
if (results.ts[i].TestCases){
console.log(results.ts[i].TestCases.length);
for(var j = 0; j < results.ts[i].TestCases.length; j++){
// console.log(results.ts[i].TestCases.length);
// console.log(results.ts[i].TestCases[j].FormattedID);
t += " ";
t += results.ts[i].TestCases[j].FormattedID;
}
results.ts[i].TestCases=t;
}
table.addRows(results.ts);
table.display(document.getElementById('tableDiv'));
}
}
function dropdownChanged(dropdown, eventArgs) {
if(table) {
table.destroy();
}
document.getElementById('tableDiv').innerHTML = "";
var queryConfig = {
type : 'testset',
key : 'ts',
fetch: 'Name,FormattedID,TestCases',
query: '(Name = "' + eventArgs.item.Name + '")'
};
rallyDataSource.findAll(queryConfig, showTable);
}
function onLoad() {
rallyDataSource = new rally.sdk.data.RallyDataSource('111', //USE YOUR OIDs
'222',
'false',
'false');
var config = {
type : "testset",
attribute: "Name",
query : '(ScheduleState = "Defined")'
};
var objectDropdown = new rally.sdk.ui.ObjectDropdown(config, rallyDataSource);
objectDropdown.display("aDiv", dropdownChanged);
}
rally.addOnLoad(onLoad);
</script>
</head>
<body>
<div id="aDiv"></div>
<div id="tableDiv"></div>
</body>
</html>

google maps api v2 map.removeOverlay() marker array issue

To start off with, I would like to say that I have been looking on the internet for a really long time and have been unable to find the answer, hence my question here.
My latest school project is to create an admin page for adding articles to a database, the articles are connected to a point on a google map. The requirement for adding the point on the map is that the user is able to click the map once and the marker is produced, if the map is clicked a second time the first marker is moved to the second location. (this is what I am struggling with.)
The problem is, as the code is now, I get the error that markersArray is undefined. If I place the var markersArray = new Array; underneath the eventListener then I get an error that there is something wrong the main.js (googles file) and markersArray[0] is undefined in the second if.
By the way, I have to use google maps API v2, even though it is old.
<script type="text/javascript">
//<![CDATA[
var map;
var markers = new Array;
function load() {
if (GBrowserIsCompatible()) {
this.counter = 0;
this.map = new GMap2(document.getElementById("map"));
this.map.addControl(new GSmallMapControl());
this.map.addControl(new GMapTypeControl());
this.map.setCenter(new GLatLng(57.668911, 15.203247), 7);
GDownloadUrl("genxml.php", function(data) {
var xml = GXml.parse(data);
var Articles = xml.documentElement.getElementsByTagName("article");
for (var i = 0; i < Articles.length; i++) {
var id = Articles[i].getAttribute("id");
var title = Articles[i].getAttribute("title");
var text = Articles[i].getAttribute("text");
var searchWord = Articles[i].getAttribute("searchWord");
var point = new GLatLng(parseFloat(Articles[i].getAttribute("lat")),
parseFloat(Articles[i].getAttribute("lng")));
var article = createMarker(point, id, title, text);
this.map.addOverlay(article);
}
});
}
var myEventListener = GEvent.bind(this.map,"click", this, function(overlay, latlng) {
if (this.counter == 0) {
if (latlng) {
var marker = new GMarker(latlng);
latlng1 = latlng;
this.map.addOverlay(marker);
this.counter++;
markers.push(marker); //This is where I get the error that markersArray is undefined.
}
}
else if (this.counter == 1) {
if (latlng){
alert (markers[0]);
this.map.removeOverlay(markers[0]);
var markers = [];
this.map.addOverlay(marker);
this.counter++;
}
}
});
}
function createMarker(point, id, title, text) {
var article = new GMarker(point);
var html = "<b>" + title + "</b> <br/>"
GEvent.addListener(article, 'click', function() {
window.location = "article.php?id=" + id;
});
return article;
}
I solved the problem. I'm not exactly sure why it worked but this is what it looks like now:
var markersArray = [];
function load() {
if (GBrowserIsCompatible()) {
this.counter = 0;
this.map = new GMap2(document.getElementById("map"));
this.map.addControl(new GSmallMapControl());
this.map.addControl(new GMapTypeControl());
this.map.setCenter(new GLatLng(57.668911, 15.203247), 7);
GDownloadUrl("genxml.php", function(data) {
var xml = GXml.parse(data);
var Articles = xml.documentElement.getElementsByTagName("article");
for (var i = 0; i < Articles.length; i++) {
var id = Articles[i].getAttribute("id");
var title = Articles[i].getAttribute("title");
var text = Articles[i].getAttribute("text");
var searchWord = Articles[i].getAttribute("searchWord");
var type = Articles[i].getAttribute("type");
var point = new GLatLng(parseFloat(Articles[i].getAttribute("lat")),
parseFloat(Articles[i].getAttribute("lng")));
var article = createMarker(point, id, title, text);
this.map.addOverlay(article);
}
});
}
var myEventListener = GEvent.bind(this.map,"click", this, function(overlay, latlng) {
var marker = new GMarker(latlng);
if (this.counter == 0) {
if (latlng) {
latlng1 = latlng;
this.map.addOverlay(marker);
markersArray.push(marker);
this.counter++;
}
}
else if (this.counter == 1) {
if (latlng){
this.map.removeOverlay(markersArray[0]);
this.map.addOverlay(marker);
this.counter++;
}
}
});
}
function createMarker(point, id, title, text) {
var article = new GMarker(point);
var html = "<b>" + title + "</b> <br/>"
GEvent.addListener(article, 'click', function() {
window.location = "article.php?id=" + id;
});
return article;
}

Plotting Points with the Google Maps API

I have a project where the client is looking to be able to create an outline around a specific area on a Google Map and have it clickable with the standard Google Maps info window.
So rather than just a standard point being plotted at a specific lat and long location it would need to create multiple points and a stroke/outline.
Does anyone know if this is even possible with the Google Maps api?
Thanks.
Sample code:
toggleCommentMode(true);
function toggleCommentMode(isCommentMode){
if(isCommentMode){
//$("#map img").css("cursor", "crosshair !important");
commentModeEventListener = google.maps.event.addListener(FRbase, 'click', commentListener);
}
else{
//$("#map img").css("cursor", "auto !important");
google.maps.event.removeListener(commentModeEventListener);
}
}
//}}}
function commentListener(evt){
var newMarker = new google.maps.Marker({
position: evt.latLng,
draggable : true,
title : "Drag me; Double click to remove",
map : map
});
google.maps.event.addListener(newMarker, 'dragend',function(){
updateMarkerList();
});
google.maps.event.addListener(newMarker, 'dblclick',function(){
$(myMarkers["userComment"]).each(function(i,marker){
if(marker === newMarker){
marker.setMap(null);
Array.remove(myMarkers["userComment"], i);
updateMarkerList();
}
});
});
if(typeof myMarkers["userComment"] == "undefined"){
myMarkers["userComment"] = [];
}
myMarkers["userComment"].push(newMarker);
updateMarkerList();
}
//update marker list
//{{{
function updateMarkerList(){
$("#commentMarkerList").empty();
var path = [];
if(myMarkers["userComment"].length == 0){
$("#commentAccord .step").hide();
}
else{
$("#commentAccord .step").show();
}
$(myMarkers["userComment"]).each(function(i, marker){
path.push(marker.getPosition());
var listItem = $("<li></li>").addClass("ui-state-default").attr("id", i);
$(listItem).mouseenter(function(){
marker.setShadow("img/highlightmarker.png");
});
$(listItem).mouseleave(function(){
marker.setShadow("");
});
var titleLink = $("<a></a>").attr({
innerHTML : "Point",
href : "javascript:void(0);"
});
var removeLink = $("<a></a>").attr({
innerHTML : "(remove this)",
href : "javascript:void(0);"
});
$(removeLink).click(function(){
marker.setMap(null);
Array.remove(myMarkers["userComment"], i);
updateMarkerList();
});
$(listItem).append(
$("<span></span>").addClass("ui-icon ui-icon-arrowthick-2-n-s")
);
$(listItem).append(titleLink).append(removeLink);
$("#commentMarkerList").append(listItem);
});
if(typeof userCommentPolyline != "undefined"){
userCommentPolyline.setMap(null);
}
var polylineopts = {
path : path,
strokeColor : "#FF0000",
strokeWeight : 5,
strokeOpacity : 1
};
userCommentPolyline = new google.maps.Polyline(polylineopts);
userCommentPolyline.setMap(map);
$("#commentMarkerList").sortable({
placeholder: 'ui-state-highlight',
stop : function(evt, ui){
var newList = [];
$("#commentMarkerList li").each(function(i,listitem){
newList.push(myMarkers["userComment"][parseInt($(listitem).attr("id"))]);
});
myMarkers["userComment"] = newList;
updateMarkerList();
}
});
$("#commentMarkerList").disableSelection();
}
//}}}
//clear User comments
//{{{
function clearUserComments(type){
if(typeof myMarkers[type] !== "undefined"){
$(myMarkers[type]).each(function(i,marker){
marker.setMap(null);
});
myMarkers[type]=[];
if(type == "userComment"){
updateMarkerList();
}
}
}
//}}}
//create comments
//{{{
function createComments(){
$.getJSON('data.aspx',
{"p":"commentdata","d":new Date().getTime()},
function(data){
//console.log(data);
$(data).each(function(i,comment){
//console.log(commentTypes[comment.cat_id-1]);
if(typeof commentTypes[comment.cat_id-1] !== "undefined") {
if(typeof commentTypes[comment.cat_id-1].comments == "undefined"){
commentTypes[comment.cat_id-1]["comments"] = [];
}
//create path and anchor from comment.positions
//{{{
var path = [];
var anchor;
$(comment.positions).each(function(i, position){
var pos = new google.maps.LatLng(
position.lat,
position.lng
);
if(position.anchor){
anchor = pos;
}
path.push(pos);
});
//}}}
var isLine = (path.length > 1);
//marker and poly line creation
//{{{
var iconToShow = (isLine)?
commentTypes[comment.cat_id-1].markerLineImage
: commentTypes[comment.cat_id-1].markerImage;
var marker = new google.maps.Marker({
//map : map,
title : commentTypes[comment.cat_id-1].title,
position : anchor,
icon : iconToShow
});
var polyline = new google.maps.Polyline({
path : path,
strokeColor : "#106999",
strokeWeight : 5,
map : null,
strokeOpacity : 1
});
//}}}
//link bar in infowindow creation
//{{{
var zoomLink = $("<a></a>").attr({
href : "javascript:zoomTo("+anchor.lat()+","+anchor.lng()+",16);javascript:void(0);",
innerHTML : "Zoom here"
}).addClass("infowinlink");
var likeLink = $("<a></a>").attr({
href : "javascript:markerVote("+comment.id+",true);void(0);",
innerHTML : "Like"
}).addClass("infowinlink likelink");
var dislikeLink = $("<a></a>").attr({
href : "javascript:markerVote("+comment.id+",false);void(0);",
innerHTML : "Dislike"
}).addClass("infowinlink dislikelink");
var linkBar = $("<div></div>").addClass('linkbar').append(zoomLink).append(" | ")
.append(likeLink).append(" | ")
.append(dislikeLink);
if(isLine){
var showLineLink = $("<a></a>").attr({
href : "javascript:myMarkers["+comment.id+"].line.setMap(map);$('.toggleLineLink').toggle();void(0);",
innerHTML : "Show line",
id : "infowin-showline"
}).addClass("infowinlink toggleLineLink");
var hideLineLink = $("<a></a>").attr({
href : "javascript:myMarkers["+comment.id+"].line.setMap(null);$('.toggleLineLink').toggle();void(0);",
innerHTML : "Hide line",
id : "infowin-hideline"
}).addClass("infowinlink toggleLineLink");
$(linkBar).append(" | ").append(showLineLink).append(hideLineLink);
}
//}}}
//var content = "<div class='infowin'><h4>"+commentTypes[comment.cat_id-1].title +"</h4><p>"+comment.text+"</p>";
var content = "<div class='infowin'><h4>"+comment.name +"</h4><p>"+comment.text+"</p>";
content += $(linkBar).attr("innerHTML")+"</div>";
//marker click function
//{{{
google.maps.event.addListener(marker, 'click', function(){
infoWin.setContent(content);
infoWin.open(map, marker);
currMarkerDom(comment.id);
});
//}}}
var obj = {"marker": marker, "line":polyline};
commentTypes[comment.cat_id-1].comments.push(obj);
myMarkers[comment.id]=obj;
////myMarkers.all = $.map(myMarkers, function (n,i) { return n; });
//myMarkers.all.push(marker);
markerArray.push(marker);
}});
var isLoad = false;
google.maps.event.addListener(map,'tilesloaded', function () {
if (!isLoad) {
isLoad = true;
mc = new MarkerClusterer(map, markerArray, {maxZoom:16});
}
});
}
);
}
//}}}

Page refresh with onclick event in dojo and I don't want a page refresh

For some reason in IE8 when I run this function after an onclick event it causes a page refresh. I don't wan the page refresh to happen.
var edealsButton = dojo.byId("edeals_button");
var edealEmailInput = dojo.byId("edeals_email");
var edealsSignup = dojo.byId("edeals_signup");
var edealsThankYou = dojo.byId("edeals_thankyou");
var currentValue = dojo.attr(edealEmailInput, 'value');
if (currentValue != '' && currentValue != 'Enter your email') {
var anim = dojox.fx.flip({
node: edealsSignup,
dir: "right",
duration: 300
})
dojo.connect(anim, "onEnd", this, function() {
edealsSignup.style.display = "none";
edealsThankYou.style.display = "block";
})
dojo.connect(anim, "onBegin", this, function() {
var criteria = { "emailAddress": '"' + currentValue + '"' };
alert("currentValue " + currentValue);
var d = essentials.CallWebserviceMethod('AlmondForms.asmx/SignupEdeal', criteria);
d.addCallback(function(response) {
var obj = dojo.fromJson(response);
alert(obj.d);
if (obj != null && obj.d != null) {
//alert(obj.d);
if (obj.d == false)
{
var edealSuccess = dojo.byId("edeals_succes_thankyou");
var edealError = dojo.byId("edeals_error_thankyou");
alert("edealError: " + edealError);
dojo.style(edealSuccess, "display", "none");
dojo.style(edealError, "display", "inline-block");
}
else
{
var edealSuccess = dojo.byId("edeals_succes_thankyou");
var edealError = dojo.byId("edeals_error_thankyou");
dojo.style(edealSuccess, "display","inline-block");
dojo.style(edealError, "display", "none");
}
}
else {
var edealSuccess = dojo.byId("edeals_succes_thankyou");
var edealError = dojo.byId("edeals_error_thankyou");
dojo.style(edealSuccess, "display", "none");
dojo.style(edealError, "display", "inline-block");
}
});
})
anim.play();
edealEmailInput.innerHTML == 'Enter your email';
}
else
{
dojo.attr(edealEmailInput, 'value', 'Enter your email');
dojo.style(edealEmailInput, 'color', '#CC2525');
}
It looks like your "d.addCallback" code might not be disposed of properly. You might want to try placing "dojo.stopEvent()" possibly before the "anim.play();" line and see if this would stop the postback.
From the api.dojotoolkit.org site, the dojo.stopEvent() "prevents propagation and clobbers the default action of the passed event". From the docs.dojocampus.org site, they say that "dojo.stopEvent(event) will prevent both default behavior any any propagation (bubbling) of an event."
Good luck, and hope this helps you out some.