Last active
August 9, 2020 14:37
Revisions
-
kriswebdev revised this gist
Aug 9, 2020 . 1 changed file with 16 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ // ==UserScript== // @name Better Tripadvisor // @description Precise ratings, no restaurant ads, website link, phone number, google search link // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @include https://www.tripadvisor.tld/* // @version 2020.08 // @grant GM_xmlhttpRequest // @grant GM_addStyle // @require http://code.jquery.com/jquery-2.1.4.min.js @@ -16,6 +16,10 @@ this.$ = this.jQuery = jQuery.noConflict(true); GM_addStyle('.ui_icon.google::before { content: "\u2315"; }'); // Restaurants: Remove adds GM_addStyle('div[data-test="SL_list_item"] { display: none; }'); /* PRECISE RATINGS */ var coeff = 5; @@ -85,6 +89,16 @@ if (!sumReviews) { } } if (sumReviews) { result = (Math.round(result/sumReviews*10))/10; // console.log("Result="+result); $("span[class*='__overallRating']").css("display","hide"); $("div#ABOUT_TAB").parent().parent().before($("<div>").attr( "style", "font-size: 48px;line-height: 22px;font-weight: 700;color: #078171; padding-bottom: 20px").text(result.toFixed(1))); } /* LEFT/RIGHT KEYS TO SLIDE PHOTOS */ /* $(document).keyup(function(e) { -
kriswebdev revised this gist
Jul 19, 2020 . 1 changed file with 20 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ // ==UserScript== // @name Better Tripadvisor // @description Precise ratings, website link, phone number, google search link, left/right keys in photo viewer // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @include https://www.tripadvisor.tld/* // @version 2020.07 // @grant GM_xmlhttpRequest // @grant GM_addStyle // @require http://code.jquery.com/jquery-2.1.4.min.js @@ -25,9 +25,10 @@ var percentReviews = 0; var stop = 0; // Hotels $("label[for^='ReviewRatingFilter_']").parent("li").each(function(index,val) { var irating = $(this).children("span").last().text(); console.log(irating); percentReviews = parseInt(irating.replace(/\s+/g, '')); result += percentReviews*coeff--; sumReviews += percentReviews; }); @@ -84,6 +85,19 @@ if (!sumReviews) { } } /* LEFT/RIGHT KEYS TO SLIDE PHOTOS */ /* $(document).keyup(function(e) { switch (e.key) { case "ArrowRight": $("div.navigationItem.single-chevron-right").click(); break; case "ArrowLeft": $("div.navigationItem.single-chevron-left").click(); break; } }); */ /* HELPER FUNCTIONS */ -
kriswebdev revised this gist
Jul 28, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -65,7 +65,6 @@ if (!sumReviews) { // Attraction Reviews if (!sumReviews) { stop=0; $(".row_num.is-shown-at-tablet").each(function(index, val) { if(stop++ == 5) -
kriswebdev revised this gist
Jul 28, 2019 . 1 changed file with 59 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,15 @@ // ==UserScript== // @name Better Tripadvisor: Precise ratings, website link, phone, google search // @description Display the exact Tripadvisor note after the "bubbles" & also the website link and phone number // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @include https://www.tripadvisor.tld/* // @version 1.8 // @grant GM_xmlhttpRequest // @grant GM_addStyle // @require http://code.jquery.com/jquery-2.1.4.min.js // @icon https://static.tacdn.com/favicon.ico // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); @@ -21,19 +22,70 @@ var coeff = 5; var result = 0; var sumReviews = 0; var percentReviews = 0; var stop = 0; // Hotels $("label[for^='ReviewRatingFilter_']").parent("li").children("span[class*='row_num']").each(function(index, val) { //console.log($(this).text()); percentReviews = parseInt($(this).text().replace(/\s+/g, '')); result += percentReviews*coeff--; sumReviews += percentReviews; }); if (sumReviews) { result = (Math.round(result/sumReviews*10))/10; // console.log("Result="+result); $("span[class*='__overallRating']").css("display","hide"); $("div#ABOUT_TAB").parent().parent().before($("<div>").attr( "style", "font-size: 48px;line-height: 22px;font-weight: 700;color: #078171; padding-bottom: 20px").text(result.toFixed(1))); } // Attractions if (!sumReviews) { stop=0; $(".row_count").each(function(index, val) { if(stop++ == 5) return false; percentReviews = parseInt($(this).text().replace(/[^0-9]/g, '')); result += percentReviews*coeff--; sumReviews += percentReviews; stop++; }); if (sumReviews) { // console.log(sumReviews); result = (Math.round(result/sumReviews*10))/10; console.log("Result="+result); $("span[class*='__overallRating']").css("display","hide"); $("div#btf_wrap").prepend($("<div>").attr( "style", "font-size: 48px;line-height: 22px;font-weight: 700;color: #078171; padding-top: 20px").text(result.toFixed(1))); } } // Attraction Reviews if (!sumReviews) { console.log($(".row_count")); stop=0; $(".row_num.is-shown-at-tablet").each(function(index, val) { if(stop++ == 5) return false; percentReviews = parseInt($(this).text().replace(/[^0-9]/g, '')); result += percentReviews*coeff--; sumReviews += percentReviews; stop++; }); if (sumReviews) { result = (Math.round(result/sumReviews*10))/10; // console.log("Result="+result); $("span[class*='__overallRating']").css("display","hide"); $("div#REVIEWS").parent().prepend($("<div>").attr( "style", "font-size: 48px;line-height: 22px;font-weight: 700;color: #078171; padding-bottom: 20px").text(result.toFixed(1))); } } /* HELPER FUNCTIONS */ function getHTTP(queryURL, handlerPassArg, handler) { @@ -97,7 +149,7 @@ if (jBlRow.length) { var blEntryWebsite=$(".blEntry.website"); var needPhone=!blEntryPhone.length;// && !$blEntryPhone.find("a[href^='/UpdateListing-']").length; var needWebsite=!blEntryWebsite.length;// && !blEntryWebsite.find("a[href^='/UpdateListing-']").length; // console.log(needWebsite); if (jUpdateListingAnchor.length && (needPhone || needWebsite)) getHTTP(jUpdateListingAnchor[0].href, jBlRow, appendGeneralInfo); -
kriswebdev revised this gist
Jun 24, 2018 . 1 changed file with 23 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,13 +5,16 @@ // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @include https://www.tripadvisor.tld/* // @version 1.6 // @grant GM_xmlhttpRequest // @grant GM_addStyle // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); GM_addStyle('.ui_icon.google::before { content: "\u2315"; }'); /* PRECISE RATINGS */ var coeff = 5; @@ -54,37 +57,48 @@ function getHTTP(queryURL, handlerPassArg, handler) { }); } /* WEBSITE LINK, PHONE HANDLER */ function appendGeneralInfo(response, jContainer, queryurl) { var websiteURL = null; var phoneNum = null; var genInfoHTML = ""; if(needPhone) if(phoneNum=response.match(/data-attr="phone"\s*value="([0-9 \+\(\)]+)"/)) genInfoHTML+='<div class="blEntry phone"><a class="ui_link" href="tel:'+phoneNum[1].replace(/ /g, '')+'" data-column="1"><span class="ui_icon phone"></span><span class="is-hidden-mobile detail">'+phoneNum[1]+'</span></a></div>'; if(needWebsite) if(websiteURL=response.match(/data-attr="website"\s*value="(https?:\/\/[^"]+)"/)) genInfoHTML+='<div class="is-hidden-mobile blEntry website ui_link " data-column="2" data-trackingkey=""><span class="ui_icon laptop detail"></span><a href="'+websiteURL[1].replace(/[\\\"'\x00-\x1F\x7F-\x9F]/g, '')+'" target="_blank"><span class="detail">Website</span></a></div>'; if (genInfoHTML) jContainer.append(genInfoHTML); } /* LAUNCHERS */ var jBlRow=$("div.headerBL > .blRow"); if (jBlRow.length) { /* GOOGLE SEARCH LINK */ var jHeader=$("h1#HEADING"); if(jHeader.length) { var googleSearchHTML = ""; googleSearchHTML+='<div class="is-hidden-mobile blEntry ui_link " data-column="2" data-trackingkey=""><span class="ui_icon google detail"></span><a href="https://www.google.com/search?ie=utf-8&q='+encodeURIComponent(jHeader.text())+'" target="_blank"><span class="detail">Google</span></a></div>'; jBlRow.append(googleSearchHTML); } /* WEBSITE LINK, PHONE LAUNCHER */ var jUpdateListingAnchor=$("a[href^='/UpdateListing-']"); var blEntryPhone=$(".blEntry.phone"); var blEntryWebsite=$(".blEntry.website"); var needPhone=!blEntryPhone.length;// && !$blEntryPhone.find("a[href^='/UpdateListing-']").length; var needWebsite=!blEntryWebsite.length;// && !blEntryWebsite.find("a[href^='/UpdateListing-']").length; console.log(needWebsite); if (jUpdateListingAnchor.length && (needPhone || needWebsite)) getHTTP(jUpdateListingAnchor[0].href, jBlRow, appendGeneralInfo); } -
kriswebdev revised this gist
Jun 24, 2018 . No changes.There are no files selected for viewing
-
kriswebdev renamed this gist
Jun 24, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
kriswebdev revised this gist
Jun 24, 2018 . 1 changed file with 71 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,90 @@ // ==UserScript== // @name Better Tripadvisor: Precise ratings, website link, phone, google search // @description Display the exact Tripadvisor note after the "bubbles" // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @include https://www.tripadvisor.tld/* // @version 1.5 // @grant GM_xmlhttpRequest // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); /* PRECISE RATINGS */ var coeff = 5; var result = 0; var sumReviews = 0; var percentReviews = 0; $(".reviews .row_count").each(function(index, val) { //console.log($(this).text()); percentReviews = parseInt($(this).text().replace(/\s+/g, '')); result += percentReviews*coeff--; sumReviews += percentReviews; }); if (sumReviews) { result = (Math.round(result/sumReviews*10))/10; $(".reviews .overallRating").text(result+" "); } /* HELPER FUNCTIONS */ function getHTTP(queryURL, handlerPassArg, handler) { var http; GM_xmlhttpRequest({ method: "GET", url: queryURL, timeout: 15000, headers: { Referer: document.URL }, onreadystatechange: function(http) { if (http.readyState == 4) { if(http.status == 200) { handler(http.responseText, handlerPassArg, queryURL); } http = null; } } }); } /* WEBSITE LINK, PHONE */ function appendGeneralInfo(response, jContainer, queryurl) { var websiteURL = null; var phoneNum = null; var genInfoHTML = ""; if(phoneNum=response.match(/data-attr="phone"\s*value="([0-9 \+\(\)]+)"/)) genInfoHTML+='<div class="blEntry phone"><a class="ui_link" href="tel:'+phoneNum[1].replace(/ /g, '')+'" data-column="1"><span class="ui_icon phone"></span><span class="is-hidden-mobile detail">'+phoneNum[1]+'</span></a></div>'; if(websiteURL=response.match(/data-attr="website"\s*value="(https?:\/\/[^"]+)"/)) genInfoHTML+='<div class="is-hidden-mobile blEntry website ui_link " data-column="2" data-trackingkey=""><span class="ui_icon laptop detail"></span><a href="'+websiteURL[1].replace(/[\\\"'\x00-\x1F\x7F-\x9F]/g, '')+'" target="_blank"><span class="detail" style="color:#006699">Website</span></a></div>'; if (genInfoHTML) jContainer.append(genInfoHTML); } /* GOOGLE SEARCH LINK */ var jBlRow=$("div.headerBL > .blRow"); if (jBlRow.length) { var jHeader=$("h1#HEADING"); if(jHeader.length) { var googleSearchHTML = ""; googleSearchHTML+='<div class="is-hidden-mobile blEntry website ui_link " data-column="2" data-trackingkey=""><span class="ui_icon laptop detail"></span><a href="https://www.google.com/search?ie=utf-8&q='+encodeURIComponent(jHeader.text())+'" target="_blank"><span class="detail" style="color:#006699">Google</span></a></div>'; jBlRow.append(googleSearchHTML); } var jUpdateListingAnchor=$("a[href^='/UpdateListing-']"); if (jUpdateListingAnchor.length) getHTTP(jUpdateListingAnchor[0].href, jBlRow, appendGeneralInfo); } -
kriswebdev revised this gist
Jun 5, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ==UserScript== // @name Tripadvisor precise note // @description This userscript replaces the Tripadvisor note rounded at 0.5 by a note rounded at 0.1 // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* -
kriswebdev revised this gist
Jun 5, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,8 @@ // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @include https://www.tripadvisor.tld/* // @version 1.4 // @grant none // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== -
kriswebdev revised this gist
Jun 5, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @version 1.3 // @grant none // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== -
kriswebdev revised this gist
Jun 5, 2017 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,6 @@ // @description Display the exact Tripadvisor note after the "bubbles" // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.tld/* // @version 1.2 // @grant none -
kriswebdev revised this gist
Jun 5, 2017 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,16 +16,16 @@ this.$ = this.jQuery = jQuery.noConflict(true); var coeff = 5; var result = 0; var sommeAvis = 0; var pourcentAvis = 0; $(".reviews .row_count").each(function(index, val) { //console.log($(this).text()); pourcentAvis = parseInt($(this).text().replace(/\s+/g, '')); result += pourcentAvis*coeff--; sommeAvis += pourcentAvis; }); if (sommeAvis) { result = (Math.round(result/sommeAvis*10))/10; $(".reviews .overallRating").text(result+" "); } -
kriswebdev revised this gist
Aug 4, 2015 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,8 @@ // @author KrisWebDev // @include http://www.tripadvisor.fr/* // @include http://www.tripadvisor.com/* // @include http://www.tripadvisor.tld/* // @version 1.2 // @grant none // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== @@ -17,10 +18,11 @@ var result = 0; var sommeAvis = 0; var nbAvis = 0; $("span.compositeCount, div.valueCount").each(function(index, val) { console.log($(this).text()); nbAvis = parseInt($(this).text().replace(/\s+/g, '')); result += nbAvis*coeff--; sommeAvis += nbAvis; }); if (sommeAvis) { -
kriswebdev revised this gist
Jun 3, 2015 . 1 changed file with 11 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,26 +2,28 @@ // @name Tripadvisor precise note // @description Display the exact Tripadvisor note after the "bubbles" // @namespace KrisWebDev // @author KrisWebDev // @include http://www.tripadvisor.fr/* // @include http://www.tripadvisor.com/* // @version 1.1 // @grant none // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); var coeff = 5; var result = 0; var sommeAvis = 0; var nbAvis = 0; $("span.compositeCount").each(function(index, val) { nbAvis = parseInt($(this).text().replace(/\s+/g, '')); result += nbAvis*coeff--; sommeAvis += nbAvis; }); if (sommeAvis) { result = (Math.round(result/sommeAvis*10))/10; $("span.rate.sprite-rating_rr").after($("<span><b>"+result+"</b></<span>")); } -
kriswebdev revised this gist
Jun 3, 2015 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,27 @@ // ==UserScript== // @name Tripadvisor precise note // @description Display the exact Tripadvisor note after the "bubbles" // @namespace KrisWebDev // @include http://www.tripadvisor.fr/* // @include http://www.tripadvisor.com/* // @version 1 // @grant none // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); var coeff = 5; var result = 0; var sommeAvis = 0; var nbAvis = 0; $("span.compositeCount").each(function(index, val) { nbAvis = parseInt($(this).text()); result += nbAvis*coeff--; sommeAvis += nbAvis; }); result = (Math.round(result/sommeAvis*10))/10; $("span.rate.sprite-rating_rr").after($("<span><b>"+result+"</b></<span>")); -
kriswebdev created this gist
Jun 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ // ==UserScript== // @name Tripadvisor precise note // @namespace KrisWebDev // @include http://www.tripadvisor.fr/* // @version 1 // @grant none // @require http://code.jquery.com/jquery-2.1.4.min.js // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); var coeff = 5; var result = 0; var sommeAvis = 0; var nbAvis = 0; $("span.compositeCount").each(function(index, val) { nbAvis = parseInt($(this).text()); result += nbAvis*coeff--; sommeAvis += nbAvis; }); result = (Math.round(result/sommeAvis*10))/10; $("span.rate.sprite-rating_rr").after($("<span><b>"+result+"</b></<span>"));