Please subscribe to keep reading. You can cancel at any time.
Loading&hellp;
{{title}}
{{description}}
{{banner}}
{{format_dollars}} {{start_price}} {{format_cents}} {{promotional_format_dollars}} {{promotional_price}} {{promotional_format_cents}} {{term}}
(renews at {{format_dollars}}{{start_price}}{{format_cents}}/month + tax)
'; } else { var sFallBack = 'Click here to subscribe'; } $('#lee-services-list .loading').hide(); $('#lee-services-list').html('
'+sFallBack+'
'); $('.lee-featured-subscription').html(sFallBack); } function lee_formatPackage(oService){ try { var bOnlyModal = true; var oSettings = lee_getPackageSettings(oService.HomeMembership); var newService = {}; if(parseInt(oService.WebFeatureFG) === 2) return false; if(oService.WebStartPrice != ''){ var custom = JSON.parse(oService.WebStartPrice); $.each(custom, function(k,v){ newService[k] = v; }); } if(bOnlyModal && newService.in_modal && newService.in_modal.toLowerCase() === 'false') return false; if(!bOnlyModal && newService.not_members && newService.not_members.toLowerCase() === 'true') return false; newService.has_featured_class = newService.featured ? 'featured-package' : ''; newService.sort = parseInt((newService.sort) ? newService.sort : oSettings.sort); newService.title = (newService.package_title && newService.package_title != '') ? newService.package_title : oSettings.title; newService.level = oService.HomeMembership; newService.html = oService.WebOfferHTML; newService.disabled = newService.disable_purchase ? 'disabled' : ''; var price = lee_formatPackagePrice(newService.start_price); newService.start_price = price.cost; newService.format_dollars = (price.format_dollars) ? price.format_dollars : ''; newService.format_cents = (price.format_cents) ? price.format_cents : ''; newService.start_at_rate = (newService.fixed_rate === 'true') ? 'for the low price of' : 'starting at'; if( !newService.term ) newService.term = 'per month'; newService.has_promotion_class = ''; if( newService.promotional_price && newService.promotional_price != '' ){ newService.has_promotion_class = 'has-promotion'; var promotion = lee_formatPackagePrice(newService.promotional_price); newService.promotional_price = promotion.cost; newService.promotional_format_dollars = (promotion.format_dollars) ? promotion.format_dollars : ''; newService.promotional_format_cents = (promotion.format_cents) ? promotion.format_cents : ''; } newService.banner_class = ''; if( newService.banner && newService.banner != '' ){ newService.banner_class = 'has-banner'; } newService.description = (newService.description) ? newService.description : ''; newService.special_title_class = newService.special_title ? 'has-special-title' : ''; newService.special_label_class = newService.label ? 'has-label' : ''; newService.action_button = 'Sign Up'; if(newService.disabled === 'disabled'){ newService.start_at_rate = 'Call us at'; newService.start_price = '(855) 264-2511'; newService.term = 'to get started'; newService.action_button = 'Call Today'; } window.lee_service_impressions.push({ 'id': newService.level, 'name': newService.title, 'price': newService.start_price, 'brand': "pantagraph.com", 'category': 'subscription', 'list': 'Block', 'position': newService.sort }); return newService; } catch(e){ if(window.console) console.warn(e); return false; } } function lee_sortPackages(property) { var sortOrder = 1; if(property[0] === "-") { sortOrder = -1; property = property.substr(1); } return function (a,b) { var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0; return result * sortOrder; } } function lee_getPackageSettings(sPackage){ switch(sPackage.toLowerCase()){ case 'dob': return {title: 'Digital Basic', sort: 0}; break; case 'dop': return {title: 'Digital Plus', sort: 1}; break; case 'dopl': return {title: 'Digital Platinum', sort: 2}; break; case 'silv': return {title: 'Silver', sort: 3}; break; case 'gold': return {title: 'Gold', sort: 4}; break; case 'plat': return {title: 'Platinum', sort: 5}; break; } } function lee_replacePackageTokens(sPackage, oService, sCol){ var hasPromotion = false; $.each(oService, function(k,v){ if( k === 'html'){ v = v.replace(new RegExp('{{domain}}', 'gi'), 'pantagraph.com') .replace(new RegExp('{{site_name}}', 'gi'), 'pantagraph.com') .replace(new RegExp('{{business_name}}', 'gi'), 'The Pantagraph') .replace(new RegExp('{{site_phone}}', 'gi'), '(855) 264-2511'); } sPackage = sPackage.replace(new RegExp('{{'+k+'}}', 'gi'), v); }); if(sCol) sPackage = sPackage.replace('{{col}}', sCol); return sPackage; } if(window.lee_services_active && window.lee_services_active != 'offline'){ try { var oPackages = [], oFeatured = false, sHtml = '', sTemplate = $('#lee-service-template').html(); $.each(window.leeMembershipPackages, function(i, oService){ var oService = lee_formatPackage(oService); if(oService){ oPackages.push(oService); if(oService.featured === 'true') oFeatured = oService; } }); if(oPackages.length === 0){ throw 'No packages defined'; } oPackages.sort(lee_sortPackages('sort')); if(!oFeatured) oFeatured = oPackages[0]; if(oPackages.length === 1){ window.lee_modal_service = oPackages[0]; sTemplate = $('#lee-service-template-single').html(); $('#lee-services-list').addClass('single'); } else { $('#lee-services-list').addClass('multiple'); } switch(oPackages.length){ case 6: var sCol = '2'; break; case 5: var sCol = '5ths'; break; case 4: var sCol = '3'; break; case 3: var sCol = '4'; break; case 2: var sCol = '6'; break; default: var sCol = '12'; break; } $('#lee-services-modal').addClass('packages_'+oPackages.length); $.each(oPackages, function(i, oService){ sHtml += lee_replacePackageTokens(sTemplate, oService, sCol); }); $('#lee-services-list .packages').html(sHtml).promise().then(function(){ $('#lee-services-list .loading').hide(); $('#lee-services-list .packages').css('opacity', 1); }); if(!__tnt.user.services){ if( $('.lee-featured-subscription').length > 0 && oFeatured ){ $('.lee-featured-subscription').each(function(){ var html = $(this).html(); if( !oFeatured.featured_button_text ){ if(oFeatured.promotional_price){ oFeatured.featured_button_text = oFeatured.promotional_format_dollars+oFeatured.promotional_price+oFeatured.promotional_format_cents+' '+oFeatured.term; } else { oFeatured.featured_button_text = 'Join for '+oFeatured.format_dollars+oFeatured.start_price+oFeatured.format_cents+' '+oFeatured.term; } } html = lee_replacePackageTokens(html, oFeatured); $(this).html(html); if(oFeatured.promotional_price) $(this).addClass('has-promotiom'); if( $(this).hasClass('show-after-loaded') ) $(this).show(); }); } } } catch (e) { if(window.console) console.warn(e); lee_serviceError(); } window.lee_fetched_services = true; } else { lee_serviceError('offline'); } });
People are also reading…
Tags
'); var s = document.createElement('script'); s.setAttribute('src', 'https://assets.revcontent.com/master/delivery.js'); document.body.appendChild(s); window.removeEventListener('scroll', throttledRevContent); __tnt.log('Load Rev Content'); } } }, 100); window.addEventListener('scroll', throttledRevContent);
As featured on
Here's a look back at sports happenings on this date in history, Dec. 8.
In 1940, the Chicago Bears beat Washington 73-0 for the most one-sided victory in NFL Champi…
In 1940, the Chicago Bears beat Washington 73-0 for the most one-sided victory in NFL Champi…
Most Popular
-
Norfolk State coach says racial slur yelled at one of his players by ISU fan
-
Prep Spotlight: After tragedy, Darin Bazzell takes leave of absence at Prairie Central
-
Norfolk State topples Illinois State in spirited battle at Horton Field House
-
Bloomington man held on home invasion charges
-
Illinois State University interim president Tarhule not leaving for Indiana University role
Print Ads
As an enthusiast with a demonstrable understanding of the topic, I'll provide insights into the concepts mentioned in the provided article. My expertise lies in web development, specifically in JavaScript, HTML, and CSS, which are evident in the code snippet you've shared. Let's break down the key concepts used in the code:
-
JavaScript Functions: The code includes several JavaScript functions. Functions like
lee_sortPackages
,lee_getPackageSettings
, andlee_replacePackageTokens
demonstrate a structured approach to coding. The use of functions indicates a modular and organized coding style, promoting reusability and maintainability. -
Array Manipulation: The code utilizes arrays to store and manipulate data. For example, the
oPackages
array stores information about different service packages, and thewindow.lee_service_impressions
array is used to track service impressions. Array manipulation is a fundamental skill in JavaScript programming. -
HTML Manipulation with jQuery: The code employs jQuery, a JavaScript library, to manipulate HTML elements. jQuery simplifies tasks like selecting elements, handling events, and updating the content of the page. For instance,
$('#lee-services-list .loading').hide();
hides the loading element on the page. -
Conditional Statements: Conditional statements, such as
if
statements, are used to control the flow of the program. An example is the check for the existence of featured services:if(!oFeatured) oFeatured = oPackages[0];
-
JSON Parsing: The code involves parsing JSON data. The
JSON.parse
method is used to convert a JSON-formatted string (e.g.,oService.WebStartPrice
) into a JavaScript object. This is commonly used when dealing with data from external sources. -
Promises in JavaScript: The use of promises is evident in the code, such as when updating the HTML content of the services list. Promises are a way to handle asynchronous operations, ensuring that certain actions are taken after an asynchronous task is completed.
-
Event Handling: Event handling is crucial in web development, and the code uses event listeners to trigger functions. For instance,
window.addEventListener('scroll', throttledRevContent);
attaches a function to the scroll event. -
CSS Manipulation: The code dynamically adds CSS classes to HTML elements. This is seen in statements like
$(this).addClass('has-promotion');
, where the class 'has-promotion' is added based on certain conditions. -
Regular Expressions: Regular expressions are used in the code, as seen in the
replace
method. Regular expressions are powerful tools for string manipulation, and here they are used to replace placeholders with actual values. -
Error Handling: The code includes a try-catch block to handle potential errors. This is a good practice for robust code, as it ensures that if an error occurs, it can be caught and handled appropriately.
In summary, the code showcases a combination of JavaScript programming, jQuery usage, and good coding practices for web development. The developer demonstrates a solid understanding of front-end technologies and a structured approach to building dynamic web pages.