Bootstrap-wysiwyg minimal usage ( supoort added without jQuery HotKeys and Font-Awesome.css )
A tiny Bootstrap and jQuery based WYSIWYG rich text editor based on the browser function execCommand.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var old = ('Iseeit Inc'); |
// mongoose 4.3.x | |
var mongoose = require('mongoose'); | |
/* | |
* Mongoose by default sets the auto_reconnect option to true. | |
* We recommend setting socket options at both the server and replica set level. | |
* We recommend a 30 second connection timeout because it allows for | |
* plenty of time in most operating environments. | |
*/ | |
var options = { |
//Jsfiddle https://jsfiddle.net/h2u4fowj/58/ | |
function str2ab(str) { | |
var buf = new ArrayBuffer(str.length); | |
var bufView = new Uint8Array(buf); | |
for (var i = 0, strLen = str.length; i < strLen; i++) { | |
bufView[i] = str.charCodeAt(i); | |
} | |
return buf; | |
} |
//More Details https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver | |
//Will not work if more then one lookup is used on same page | |
//Please remove all comments for live | |
//Add Mututationobserver on selected component | |
$("#component-abca-2a71-4474").on("click",".search_for_salesforce_record,.lookup_salesforce_record ", function() { | |
new MutationObserver(function(mutations) { | |
// Do something here | |
if($('#component-abca-2a71-4474 .found_record_list li') && $('#component-abca-2a71-4474 .found_record_list li').length > 0) { | |
//Add css to change for lookup result | |
$('#component-abca-2a71-4474 .found_record_list li').append('<span class="glyphicon glyphicon-hand-up"></span><style>#select_icon{display:none}.found_record_list #select_icon{display:inline}</style>'); |
JS library based on the File API to cache images for offline recovery (target: cordova/phonegap & chrome) https://github.com/chrisben/imgcache.js
This library is using HTML5 file api system. Some of File Api method is not supported in safar and Mozilla firfox. Here in above two example we are using canvs and File reader to storae image data in local storage for offline access.
Answer by Rob W http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser/9851769#9851769
Googling for browser reliable detection often results in checking the User agent string. This method is not reliable, because it's trivial to spoof this value.
I've written a method to detect browsers by [duck-typing][1].
Only use the browser detection method if it's truly necessary, such as showing browser-specific instructions to install an extension. Use feature detection when possible.
//This example is using canvs toDataURL method for getting image data | |
//Save image for offline useage | |
localstorage_image_cache("f5b2-0b98-cf5f"); | |
//Save image in local storage | |
function localstorage_image_cache(graphic_image_component_id) { | |
//Return if browser is not firefox | |
if (typeof InstallTrigger == 'undefined') return; | |
// localStorage with image | |
var storage_files = JSON.parse(localStorage.getItem(graphic_image_component_id)) || {}, | |
//Get Image |
//This is a javascript code that allow image caching offline for a graphic element | |
//This example is using html 5 File Api to get image data. | |
//Please replace current component id with your graphic element id | |
localstorage_image_cache("722c-e69a-c6db"); | |
//Save image in local storage | |
function localstorage_image_cache(graphic_image_component_id) { | |
//Return if browser is not firefox | |
if (typeof InstallTrigger == 'undefined') return; | |
// LocalStorage with image | |
var storage_files = JSON.parse(localStorage.getItem(graphic_image_component_id)) || {}, |
//download map as png | |
downloadAsPng1() { | |
var me = this; | |
let width = me.template.querySelector("svg.d3").getBoundingClientRect().width; | |
let height = me.template.querySelector("svg.d3").getBoundingClientRect().height; | |
try { | |
const output = { name: "result1.png", width: width, height: height }; | |
let svg = | |
'<svg style="width: 100%; height: 100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' + | |
me.template.querySelector("svg.d3").innerHTML + |