Skip to content

Instantly share code, notes, and snippets.

@mo3aser
Last active December 3, 2019 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mo3aser/75f8ae959cceef1dddd76a85cc868311 to your computer and use it in GitHub Desktop.
Save mo3aser/75f8ae959cceef1dddd76a85cc868311 to your computer and use it in GitHub Desktop.
I use the follwing code on ThemeForest to add pre replies templates for the comments section, more info here https://mo3aser.com/?p=4129
/* Append the Custom Styles */
var css = '.banner{display:none !important}.comment__header{margin-bottom:1em!important}.comment__header small{clear:both!important;display:block!important}.comment__meta{padding-top:5px!important;}.headerstrip .is-hidden-tablet-and-below{padding:0!important;}.headerstrip__content--desktop{height:60px!important;padding-top:0!important;}.item-grid>li{width:139px!important;}.theme-label-Jannah{background:#00b8ff!important;}.theme-label-Jarida{background:#c70000!important;}.theme-label-Sahifa{background:orange!important;}.theme-label-name{float:right!important;font-size:16px!important;margin-left:10px!important;padding:8px 10px!important}.user-info-header__user-details{overflow:hidden!important}',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
head.appendChild(style);
style.appendChild(document.createTextNode(css));
/* */
jQuery('.comment__initial').each(function() {
var itemName = jQuery(this).find( '.comment__header small a' ).text(),
itemName = itemName.substr(0, itemName.indexOf(' ')),
clientName = jQuery(this).find( '.comment__username' ).text();
if( jQuery(this).find( '.e-text-label' ).length ){
jQuery(this).parent().find('textarea').height(280).val( '\
Hi @'+ clientName +'!\n\n\
Thanks for using '+ itemName +'. \n\n\n\n\
If you have any further questions or need assistance please create a support ticket using the link below and our support team will gladly assist and guide you \n\n\
<strong><a href="http://tielabs.com/help/">Click Here To Create An Account &amp; Get Support</a></strong> \n\n\
Thank you, we look forward to serving you!\n\n\
Best Regards.' );
}
else{
jQuery(this).parent().find('textarea').height(200).val( '\
Hi @'+ clientName +'!\n\n\
Thanks for your interest in '+ itemName +'. \n\n\n\n\
if you have any more question please do not hesitate to contact us.\n\n\
Thank you, we look forward to serving you!\n\n\
Best Regards.' );
}
jQuery(this).find( '.comment__username' ).after(' <span class="e-text-label -color-grey-dark -size-s theme-label-name theme-label-'+itemName+'">'+ itemName +'</span>');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment