https:////example.com/style.css X#random-post-container { width: auto; margin-left: 15px; } #random-post-container ul { margin: 7px 0 0; padding: 0; } #random-post-container li { list-style: none; margin: 0 0 2px; background-color: #e5e5e5; padding: 0 7px 0 7px; line-height: 24px; height: 24px; overflow: hidden; border-bottom: 1px dotted #ccc; } #random-post-container a { text-decoration: none; } #random-post-container a:hover { text-decoration: underline; } #random-post-container strong { font: normal bold 13px/1.4 Arial,Sans-Serif; }https:////example.com/script.js X/* Performa Widget Random Post * By Id Tutor Plus * https:////idtutorplus.blogspot.com * https://plus.google.com/116099308895340121198/posts */ var homePage = 'https:////idtutorplus.blogspot.com', maxResults = 7, containerId = 'random-post-container'; // Function to generate random number limited from `min` to `max` // Used to create a valid and safe random feed `start-index` function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } // Function to shuffle arrays // Used to randomize order of the generated JSON feed function shuffleArray(arr) { var i = arr.length, j, temp; if (i === 0) return false; while (--i) { j = Math.floor(Math.random() * (i + 1)); temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } return arr; } // Get a random start index function createRandomPostsStartIndex(json) { var startIndex = getRandomInt(1, (json.feed.openSearch$totalResults.$t - maxResults)); // console.log('Get the post feed start from ' + startIndex + ' until ' + (startIndex + maxResults)); document.write(''); } // Widget's main function function randomPosts(json) { var link, ct = document.getElementById(containerId), entry = shuffleArray(json.feed.entry), skeleton = "Random Post"; for (var i = 0, len = entry.length; i < len; i++) { for (var j = 0, jen = entry[i].link.length; j < jen; j++) { link = (entry[i].link[j].rel == "alternate") ? entry[i].link[j].href : '#'; } skeleton += '❖ ' + entry[i].title.$t + ''; } ct.innerHTML = skeleton + ''; } document.write('');Memuat...