// ======= BEGIN WIDGET API ======================================================================= // displays the widget and handles page parameters widgetShow = function() {widgetIFrames();} //adds a recipe to the widget user's recipe box widget_addToRecipeBox = function(id) {if(id) direct_widget('addRecipeBox=' + id);} //begins the process of adding a recipe to the widget user's planner widget_addToMealPlan = function(id) {if(id) direct_widget('addMealPlan=' + id);} // adds a recipe to the user's shopping list widget_addRecipeToShopList = function(id) {if(id) direct_widget('addRecShopList=' + id);} // adds an ingredient to the user's shopping list widget_addIngredientToShopList = function(id) {if(id) direct_widget('addIngredShopList=' + id);} //shows a recipe detail page in the widget widget_recipeDetail = function(id) {if(id) direct_widget('recipe=' + id);} // shows a recipe search page in the widget widget_recipeSearch = function(str) {if(str && str.length > 0) direct_widget('search=' + escapeURI(str));} // shows the promotions landing page in the widget widget_showCoupons = function() {direct_widget('show=coupons');} // shows a promotion detail page in the widget widget_couponDetail = function(id) {if(id) direct_widget('coupon=' + id);} // shows the results from recipe landing search in the widget widget_recipeLanding = function(name) {if(name) direct_widget('recipeGroup=' + name);} // shows results of recipes for a promotion in the widget widget_recipesForPromotion = function(id) {if(id) direct_widget('recipePromotion=' + id);} // adds a planner group to the widget widget_addPlannerGroup = function(id) {if(id) direct_widget('planner=' + id);} // ======= END WIDGET API ======================================================================= var _sessionId = '7EC4D3D8253D0453EACF4630D8260C78.lowesapp02east1b'; //this function will create an iframe with the widget using any "deep link" params on the current url. function widgetIFrames() { var url = ""; var urlPg = '' + document.location; var endFile = urlPg.indexOf("?"); var prms = 'widget.jsp;jsessionid=' + _sessionId + (endFile > 0? urlPg.substr(endFile) : ''); try {url = widget_url + '/' + prms;} catch(x) {} if(url) { var s = '
' + '' + widgetDirectorFrame() + '
'; document.write(s); } } // clearspring is now defunct - load the standard widget. function widgetClearspringEmbed() { widgetIFrames(); } // helper function - do not edit function widgetDirectorFrame() { return ''; } // helper function to manipulate the widget - do not edit function direct_widget(url) { var dir_frame = document.getElementById('fl-director'); if(dir_frame) dir_frame.src = widget_url + '/' + 'widgetDirector.jsp?' + url; } function getWidgetFrame() { return document.getElementById('widget_iframe'); } function escapeURI(s) { var s2 = ''+s; try {s2 = encodeURIComponent(s2);} catch(ex) {s2 = escape(s2);} return s2.replace(/%20/g,"+"); }