Chapter 11 Chapter: Appendx
Slideshare Image Viewer
Typically when you visit slideshare and you're looking at a presentation, the slides are converted to images and pre-prepared. To avoid stuttering and waiting, all these images are preprocessed and cached. You can write a short script to grab all the images, select those which are for the slides (not the thumb slides) and put them all at the bottom of the page. See the full presentation in one go on the page (without clicking or going slide by slide).
// ==UserScript==
// @name Slideshare Slide Viewer
// @namespace Slideshare Slide Viewer
// @version 0.2
// @description Slideshare Slide Viewer (images)
// @author userscripts.xbdev.net
// @match https://www.slideshare.net/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function viewAllSlideImages() {
let div = document.createElement('div');
document.getElementById('portals-container').appendChild( div );
div.style.width = '100%';
div.style['text-align'] = 'center';
let imgs = document.getElementsByTagName('img');
imgs = [...imgs];
let maxx = imgs.length;
for (let n=0; n < maxx; n++)
{
if ( imgs[n].id.length < 10 ) continue;
if ( imgs[n].id.includes('thumb') ) continue;
console.log('adding image:', n, imgs[n].width, imgs[n].height );
// low-res to the high-res url
//https://image.slidesharecdn.com/naivebayes-180531085617/85/naive-bayes-1-320.jpg?cb=1666204453
//https://image.slidesharecdn.com/naivebayes-180531085617/75/naive-bayes-1-2048.jpg?cb=1666204453
let src2 = imgs[n].src;
src2 = src2.replaceAll('/85/', '/75/' );
src2 = src2.replaceAll('-320', '-2048' );
let img = document.createElement('img');
img.style.width = '70%';
img.style.height = 'auto';
img.src = src2; // imgs[n].src; // swap high-res version
img.style['z-index']= '99999';
img.style['border'] = '1px solid black';
img.style['margin'] = 'auto';
img.style['display'] = 'block';
let p = document.createElement('p');
p.innerHTML = `Details: ${n}, ${imgs[n].width}, ${imgs[n].height}, ${imgs[n].id}, ${imgs[n].className}, ${imgs[n].src}, ${src2} `;
div.appendChild( img );
div.appendChild( p );
}
}
function addmybutton()
{
let btn = document.createElement("button");
btn.onclick = function() {
viewAllSlideImages();
};
btn.innerHTML = ">> Download Images Thumbs <<";
btn.style['font-size'] = '12pt';
btn.style['font-weight'] = '900';
btn.style.textDecoration = "underline"
//document.getElementsByClassName('player-toolbar-item')[0].appendChild(btn);
document.body.appendChild( btn );
btn.style['z-index'] = '99999';
btn.style['position'] = 'absolute';
btn.style['left'] = '30px';
btn.style['top'] = '60px';
}
addmybutton();
})();
Other Project Ideas to Try
• Take screenshots (store/view)
• Maching learning (e.g., Tensorflow.js) analyse the page content/threats
• Track history of page visits
• Analyse website (e.g., number images, scripts, text, load time, ...)
• Security plugin (encode/decode text messages on a website, such as gmail/hotmail/outlook client)
* End-to-end security
• Automatic email/message writer
• ChatGPT plugin
• Advert remover (remove annoying adverts/popups)
• Note manager (store/list information on website)