google maps v3 formatting multiple lines of content in infoWindow - google-maps-api-3

I am trying to create an infoWindow in google maps v3 which contains multiple lines of content. However the "\n" I am using to insert a newline doesn't seem to work. What is the recommended way to insert a newline?
see code:
//set content of infoWindow
window.setContent(inspStates[i].name+ "\n"+"total: "+inspStates[i].totalInsp+ "\n"+ info);

The easiest thing to do it wrap the content in a div or in a p and then use <br /> for line breaks.
So something like
//set content of infoWindow
window.setContent("<p>" + inspStates[i].name + "<br />" +
"total: " + inspStates[i].totalInsp + "<br />" + info +
"</p>");

Use HTML for the content, and put each line in its own paragraph. Line separation helps with readability, especially if any of the lines is long enough to wrap.
window.setContent(
"<p>" + inspStates[i].name + "</p>" +
"<p>Total: " + inspStates[i].totalInsp + "</p>" +
"<p>" + info + "</p>");

Related

How do you remove the counter circles indicating the number of slides on the Bootstrap carousel?

I want to remove the counter circles at the bottom of the bootstrap carousel. I can't find anything on this. There appears to be a number of modifications one can make to the carousel but little direction on how to do this beyond the limited resources at https://angular-ui.github.io/bootstrap/
Removing arrows in Bootstrap Carousel
was somewhat helpful.
I have no doubt that there is a better way but here is how I solved it:
I went directly into the angular-bootstrap/ui-bootstrap.tpls.js file and commented out a chunk of code. Please see below:
angular.module("uib/template/carousel/carousel.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("uib/template/carousel/carousel.html",
"<div ng-mouseenter=\"pause()\" ng-mouseleave=\"play()\" class=\"carousel\" ng-swipe-right=\"prev()\" ng-swipe-left=\"next()\">\n" +
" <div class=\"carousel-inner\" ng-transclude></div>\n" +
" <a role=\"button\" href class=\"left carousel-control\" ng-click=\"prev()\" ng-class=\"{ disabled: isPrevDisabled() }\" ng-show=\"slides.length > 1\">\n" +
" <span aria-hidden=\"true\" class=\"glyphicon glyphicon-chevron-left\"></span>\n" +
" <span class=\"sr-only\">previous</span>\n" +
" </a>\n" +
" <a role=\"button\" href class=\"right carousel-control\" ng-click=\"next()\" ng-class=\"{ disabled: isNextDisabled() }\" ng-show=\"slides.length > 1\">\n" +
" <span aria-hidden=\"true\" class=\"glyphicon glyphicon-chevron-right\"></span>\n" +
" <span class=\"sr-only\">next</span>\n" +
" </a>\n" +
// " <ol class=\"carousel-indicators\" ng-show=\"slides.length > 1\">\n" +
// " <li ng-repeat=\"slide in slides | orderBy:indexOfSlide track by $index\" ng-class=\"{ active: isActive(slide) }\" ng-click=\"select(slide)\">\n" +
// " <span class=\"sr-only\">slide {{ $index + 1 }} of {{ slides.length }}<span ng-if=\"isActive(slide)\">, currently active</span></span>\n" +
// " </li>\n" +
// " </ol>\n" +
"</div>\n" +
"");
}]);
There appears to be no other side-effects save that I was able to remove the counter circles from the bottom of the slider.

Resize image being parsed from JSON

I am parsing data from a JSON, where one of the fields on the table is an image.
Although, I want that image to fit a specific size.
I have already made so many changes, that I got lost why it doesn't work.
JSON
var products=[];
$.getJSON('products.json',function(data){
$.each(data.products, function(i, f){
var tblRow = "<tr><td class='prod_img'><img src=" + f.image_url + "></td></tr>" + "<tr><td class='title'>" + f.title + "</td></tr>" + "<tr><td class='price'>" + f.price + "</td>" + "<td class='price_org'>" + f.old_price + "</td>" + "<td class='add_cart'><img src='img/buynow-green-5.png'>" + "</td></tr>"
$(tblRow).appendTo("#list_products tbody");
});
});
CSS
#list_products{
position:absolute;
width:100%;
border: 5px solid #B9FFFF;
margin-top:80px;}
.prod_img{
height:200px;
width:300px;}
So, after sleeping some hours, I finally realized what was missing.
I had a tag for the image container, but no for the image.
Sometimes, the answer is simple. You just need to go away for a moment.

Auto fit tag clouds in a div

I have some tag clouds placed within a div. For each tag cloud there is a thumbs down icon and I used sliding tag css from http://www.cssflow.com/snippets/sliding-tags
If a tag cloud is greater than 80px, it does not fit inside that div. I used word wrap and also fittext plugin from jquery but I could not manage to make it work. Could you suggest what could be the possible solution for it?
I have created fiddle for it: http://jsfiddle.net/aexqoe8n/1/
In Js side :
resultDiv = document.getElementById('tokenCloudResultDiv');
resultDiv.innerHTML = '';
resultDiv .innerHTML="<ul class='tags blue' style='list-style-type: none;padding:5px;'>";
for (i in json) {
addToken(resultDiv, i, json[i]);
}
resultDiv.innerHTML=resultDiv.innerHTML+"</ul>";
function addToken(target, key, result) {
var str;
var weight;
if(result['tagWeight']>80)
$("#tokenCloudResultDiv").fitText(1.2);
weight= "style='font-size: " + result['tagWeight'] + "px;'";
if(addedAutomatically)
str = "<li><div><a " + weight + " >" + result['tagName'] +"</a><span class='thumbsDownIcon' id ='" + tagId + "' style='display:block;cursor:pointer;' ></span></div></li>";
target.innerHTML += str;
}

ASP.NET / C# item.FileName

litFiler.Text += [a class='group2' href='./references/big/'][img src=\"./references/small/" + item.FileName + "\" width=\"100\" /][/a][br /]";
WHERE TO PUT A '+ item.FileName' on the a class 'group2', such as it is on :
[img src=\"./references/small/" + item.FileName + "\" width=\"100\" /]
i can figure where to put it, my colorbox will open the big pictures when i click them, right know the url on hover the small picture is "references/big/"

Using <b> in fckeditor

i want to print some default string value in bold but i am using tag but it is not rendered as bold rather it is showing it is printing the same etc
var defaultFCKValue = '----Original Message---- \n';
defaultFCKValue += '<b>From:</b> ' + from + '\n';
defaultFCKValue += '<b>Sent:</b> ' + date + '\n';
defaultFCKValue += $('div.popupContent div div.message').html();
var oEditor = FCKeditorAPI.GetInstance("<%=FCKeditorSelfDocument.ClientID %>");
var oDOM = oEditor.EditorDocument;
oDOM.body.innerText = defaultFCKValue;
The problem is that the <b> tags are being escaped/encoded and are being rendered as <b>
You might want to try using
oEditor.setHtml(defaultFCKValue)
See the js docmentation for fckeditor.
Try <strong> rather than <b>, as <b> tags have been depreciated in most doctypes. It may not directly solve your problem, but it is at least good practice.

Resources