Skip to content

Instantly share code, notes, and snippets.

function santizeHTML(riskyHTML){
// create an invisible but fully functional HTML document
var doc = document.implementation.createHTMLDocument();
// set it's HTML to the HTML we need to santize
doc.body.innerHtml = riskyHTML;
// black list of tags we want to remove
var badNodes = doc.querySelectorAll("script,style,link,object");
@charleshimmer
charleshimmer / Demo.html
Created December 18, 2012 16:47
GE Appliances demo integration code
<!DOCTYPE html>
<html>
<head>
<!-- using // means the bvapi.js file will load over whatever protocal the pages uses (either http or https) -->
<script src="//geappliances.ugc.bazaarvoice.com/bvstaging/static/1218-en_us/bvapi.js"></script>
<!-- JavaScript call to bazaarvoice to load reviews for the product test1 -->
<script>
$BV.ui('rr', 'show_reviews', {
productId: 'test1'
});
@charleshimmer
charleshimmer / RRIntegrationCode.html
Last active January 1, 2016 22:29
Bazaarvoice RR integration code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<script src="//display-stg.ugc.bazaarvoice.com/static/Bazaarvoice/bvapi.js"></script>
<script>
<?php
// include bv sdk
require('BVsdk.php');
// call constructor method passing client specific data
$bv = BV(array(
'productId' => 'test1',
'currentPageUrl' => 'http://www.client.com/productId/page.php',
'staging' => TRUE, // boolean,
@charleshimmer
charleshimmer / bv.html
Last active December 14, 2015 16:58
Kohl's Upgrade Integration Code for Display
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Meat and Potatoes of BV Integration Code-->
@charleshimmer
charleshimmer / inlineRatings.html
Last active August 14, 2020 12:48
Inline Ratings (multiple product rating stars on one page)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Meat and Potatoes of BV Integration Code-->
@charleshimmer
charleshimmer / bazaarvoiceUpgradeTest.html
Created March 13, 2013 20:19
This is a plain vanilla RR and QA integration for Conversations 2.0 for Travelocity
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Meat and Potatoes of BV Integration Code-->
@charleshimmer
charleshimmer / bazaarvoiceUpgradeTest.html
Last active December 14, 2015 22:08
This is a plain vanilla RR and QA integration for Conversations 2.0 for Travelocity
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Meat and Potatoes of BV Integration Code-->
@charleshimmer
charleshimmer / gist:5342278
Last active December 15, 2015 23:39
Example Travelocity integration code for C2013 supporting all three locales
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Meat and Potatoes of BV Integration Code, for production use
@charleshimmer
charleshimmer / pdp.html
Last active April 21, 2021 02:36
Schwab Example C2013 Integraiton
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Meat and Potatoes of BV Integration Code-->