Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
  • Entries

    4
  • Comments

    2
  • Views

    6693

Entries in this blog

Hey guys!

 

I recently read a post, http://forum.tip.it/topic/311258-hide-stickies/, requesting a way to hide stickies.

 

Since it seems we aren't going to get an official way to do this, I decided to write up a greasemonkey userscript for those people who are using FireFox or GoogleChrome.

 

This userscript will add an [x] next to each sticky which will let you hide it.

 

There is a counter above the stickies that tells you how many you have hidden on that page and gives you the option to display them.

If you want to unhide a sticky you need to click "[click to show]" above the list of stickies and then choose the "[+]" option for each individual sticky you want to unhide.

 

This userscript relies on the cookie named "hidden_stickies", so if you clean out your cookies often this script won't be much help.

If for some reason the script doesn't appear to be working properly, please disable it and let me know the issues you ran into.

 

If you use it, or have any questions, let me know. :)

 

 

 

// ==UserScript==

// @name hide stickies

// @namespace forum.tip.it

// @description Lets you choose to hide stickies once you have read them, to save space.

// @include http://forum.tip.it/forum/*

// @version 1

// ==/UserScript==

 

 

// a function that loads jQuery and calls a callback function when jQuery has finished loading

function addJQuery(callback) {

var script = document.createElement("script");

script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");

script.addEventListener('load', function() {

var script = document.createElement("script");

script.textContent = "(" + callback.toString() + ")();";

document.body.appendChild(script);

}, false);

document.body.appendChild(script);

}

 

function main() {

 

//Add the functions for cookie handling

 

function getCookie(c_name)

{

var i,x,y,ARRcookies=document.cookie.split(";");

for (i=0;i<ARRcookies.length;i++)

{

x=ARRcookies.substr(0,ARRcookies.indexOf("="));

y=ARRcookies.substr(ARRcookies.indexOf("=")+1);

x=x.replace(/^\s+|\s+$/g,"");

if (x==c_name)

{

if(typeof(y) != "undefined"){

return unescape(y);

}else{

return "";

}

}else{

return "";

}

}

}

 

function setCookie(c_name,value,exdays)

{

var exdate=new Date();

exdate.setDate(exdate.getDate() + exdays);

var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()) + "; path=/forum/";

document.cookie=c_name + "=" + c_value;

}

 

function setHiddenStickiesCookie(rowid,action)

{

contents = getCookie("hidden_stickies");

 

if(action == "add")

{

contents = contents.replace(rowid+";","");

contents = contents + rowid+";";

}

 

if(action == "remove")

{

contents = contents.replace(rowid+";","");

}

 

//Check if there are any stickies hidden, if not remove the cookie

if(contents != "")

{

setCookie("hidden_stickies", contents, 365);

} else {

setCookie("hidden_stickies", "", -1);

}

}

 

 

var howManyHiddenAnnouncements = 0;

var howManyHiddenPinned = 0;

 

my_jQuery = $.noConflict(true);

 

my_jQuery(document).ready(function($){

 

 

//Add our Announcements hidden counter

$(".header").find(".col_f_topic").each(function(){

$(this).append(" <span id='totalHiddenAnnouncements'>(hidden)</span> <span id='unhideAnnouncements'>[click to show]</span>");

$("#totalHiddenAnnouncements").hide();

$("#unhideAnnouncements").hide();

});

 

//Add our Pinned hidden counter

$("th:contains(Important Topics In This Forum)").each(function(){

$(this).append(" <span id='totalHiddenPinned'>(hidden)</span> <span id='unhidePinned'>[click to show]</span>");

$("#totalHiddenPinned").hide();

$("#unhidePinned").hide();

});

 

$(".topic_prefix").each(function(){

if($(this).html() == "Pinned" || $(this).html() == "Announcement"){

$theSticky = $(this).parent().parent();

$theSticky.addClass("aSticky");

$theSticky.addClass("visibleSticky");

 

if($(this).html() == "Pinned"){$theSticky.addClass("pinSticky");}

if($(this).html() == "Announcement"){$theSticky.addClass("announceSticky");}

 

$(this).append(" <span class='stickyremover'>[x]</span>");

$(this).append("<span class='stickyshower'>[+]</span>");

 

//$(".stickyremover").hide();

$(".stickyshower").hide();

}

});

 

$(".aSticky").each(function(){

if(rowIsHidden($(this).attr("id"))){

hideTheSticky("#" + $(this).attr("id"));

}else{

//showTheSticky("#" + $(this).attr("id"));

}

});

 

function rowIsHidden(id)

{

var hiddenThreads = getCookie("hidden_stickies");

if(hiddenThreads != null && hiddenThreads != ""){

var ARRstickies=hiddenThreads.split(";");

for (i=0;i<ARRstickies.length;i++)

{

threadId = ARRstickies;

if(threadId == id){return true;}

}

}

return false;

}

 

function hideTheSticky(selector){

$(selector).each(function(){

rowId = $(this).attr('id');

$("#"+rowId).hide().removeClass("visibleSticky").addClass("hiddenSticky");

$(this).find(".stickyremover").hide();

$(this).find(".stickyshower").show();

 

if($(this).hasClass("announceSticky")){

howManyHiddenAnnouncements++;

}

if($(this).hasClass("pinSticky")){

howManyHiddenPinned++;

}

 

if(howManyHiddenAnnouncements > 0){

$("#totalHiddenAnnouncements").html("(" + howManyHiddenAnnouncements + " hidden)").show();

$("#unhideAnnouncements").show();

}else{

$("#totalHiddenAnnouncements").html("(" + howManyHiddenAnnouncements + " hidden)").hide();

$("#unhideAnnouncements").hide();

}

 

if(howManyHiddenPinned > 0){

$("#totalHiddenPinned").html("(" + howManyHiddenPinned + " hidden)").show();

$("#unhidePinned").show();

}else{

$("#totalHiddenPinned").html("(" + howManyHiddenPinned + " hidden)").hide();

$("#unhidePinned").hide();

}

 

});

}

 

function showTheSticky(selector){

$(selector).each(function(){

rowId = $(this).attr('id');

$("#"+rowId).show().removeClass("hiddenSticky").addClass("visibleSticky");

$(this).find(".stickyremover").show();

$(this).find(".stickyshower").hide();

 

 

 

if($(this).hasClass("announceSticky")){

howManyHiddenAnnouncements--;

}

if($(this).hasClass("pinSticky")){

howManyHiddenPinned--;

}

 

if(howManyHiddenAnnouncements > 0){

$("#totalHiddenAnnouncements").html("(" + howManyHiddenAnnouncements + " hidden)").show();

$("#unhideAnnouncements").show();

}else{

$("#totalHiddenAnnouncements").html("(" + howManyHiddenAnnouncements + " hidden)").hide();

$("#unhideAnnouncements").hide();

}

 

if(howManyHiddenPinned > 0){

$("#totalHiddenPinned").html("(" + howManyHiddenPinned + " hidden)").show();

$("#unhidePinned").show();

}else{

$("#totalHiddenPinned").html("(" + howManyHiddenPinned + " hidden)").hide();

$("#unhidePinned").hide();

}

 

});

}

 

function showHidden(id){

$(".hiddenSticky").each(function(){

if($(this).hasClass(id)){

$(this).find(".stickyremover").hide();

$(this).find(".stickyshower").show();

$(this).show();

}else{

}

});

}

 

function confirmHide(target)

{

if(confirm("Are you sure you want to hide the sticky?\nPress [Ok] to confirm.")){

setHiddenStickiesCookie(target,"add");

hideTheSticky("#"+target);

}

}

 

 

function confirmShow(target)

{

if(confirm("Are you sure you want to unhide the sticky?\nPress [Ok] to confirm.")){

setHiddenStickiesCookie(target,"remove");

showTheSticky("#"+target);

}}

 

 

$(".stickyshower").click(function(){

confirmShow($(this).parent().parent().parent().attr('id'));

return false;});

 

$(".stickyremover").click(function(){

confirmHide($(this).parent().parent().parent().attr('id'));

return false;});

 

$("#unhidePinned").click(function(){

showHidden("pinSticky");

});

 

$("#unhideAnnouncements").click(function(){

showHidden("announceSticky");

});

 

});

}

 

// load jQuery and execute the main function

addJQuery(main);

 

 

I've noticed that there are a fair number of bugs with the Tip.it blog's teasers / summaries.

 

In an attempt to correct some of those bugs for myself I wrote the following Greasemonkey userscript.

 

If anyone decides to use this code, leave a comment to let me know how you think it works, or if there is anything else to add.

 

Thanks.

 

 

 

 

// ==UserScript==

// @name Tip.it Blog Fixer

// @namespace Tip.it Blog Fixer

// @description Tip.it Blog Fixer

// @include http://forum.tip.it/blog*

// @include http://forum.tip.it/index.php?app=blog

// @exclude http://forum.tip.it/blog/*/entry*

// @version 1

// ==/UserScript==

 

// a function that loads jQuery and calls a callback function when jQuery has finished loading

function addJQuery(callback) {

var script = document.createElement("script");

script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");

script.addEventListener('load', function() {

var script = document.createElement("script");

script.textContent = "(" + callback.toString() + ")();";

document.body.appendChild(script);

}, false);

document.body.appendChild(script);

}

 

function main() {

 

my_jQuery = $.noConflict(true);

 

// Initialize our jQuery once the page is ready

my_jQuery(document).ready(function($)

{

 

//fix background color

$(".teaser_wrap").addClass("entry");

 

//fix image resizing

forcedWidth = Math.floor($(".teaser_wrap").width() / 2 - 12);

 

//first we remove the automated resizer info

$("div.resized_img").find("span").remove();

$(".bbc_img.resized").each(function(){

$(this).removeClass("resized");

$(this).removeAttr("handled")

.removeAttr("newheight")

.removeAttr("newwidth")

.removeAttr("origheight")

.removeAttr("shrunk")

.removeAttr("origwidth")

.removeAttr("style")

.removeAttr("height")

.removeAttr("width")

$(this).css("border","0px");

$(this).unwrap();

});

 

$(".bbc_img").each(function(){

var img = $(this).get(0);

var width = img.clientWidth;

var height = img.clientHeight;

 

if(width > forcedWidth){

var ratio = forcedWidth / width;

var newHeight = height * ratio;

$(this).width(forcedWidth);

$(this).height(newHeight);

}

});

 

 

//Fix broken BBCodes (currently just removes)

$(".entry_content").each(function(){

$(this).html(function(){

var output = $(this).html()

output = output.replace("

","");

output = output.replace("","");

output = output.replace("","");

output = output.replace("","");

output = output.replace("

","");

output = output.replace(/\*\d['"\+]*\]/g, "");

return output;

});

});

});

 

}

 

// load jQuery and execute the main function

addJQuery(main);

 

 

I thought I would write about how I'm writing greasemonkey codes to customize the Tip.it site for myself.

 

To start, I wanted the quests page to hide the completed/done quests as soon as you clicked "done", so I've written a greasemonkey javascript to do it.

748-64.png

 

The open.tip.it site requires you to click a "Save Done" button to hide/store the quests you've completed once you've clicked them.

I was thinking there was probably a way to do it without leaving the page.

 

So, I went ahead and worked on writing the code to make the quests work so when someone clicks the "Done" for any given quest it will hide it.

Also, clicking the checkbox will update the cookie that holds the quest id's for complete quests, and unchecking a box will remove the questid from the completed quests cookie, so the page will know to hide those completed quests the next time you visit.

 

This script was written using greasemonkey for Firefox 8.0 and relies on jQuery, a Javascript library.

 

If anyone ventures to use it and has any advice, please let me know. =)

 

 

// ==UserScript==
// @name           TIPQ
// @namespace      TIPQ
// @description    TIPQ Hider
// @include        http://open.tip.it/quests
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// ==/UserScript==

//Add the functions for cookie handling
function setQuestCookie(questid,action)
{
var index,key,contents,exists=0
var cookies=document.cookie.split(";");
for (index=0; index<cookies.length; index++)
 {
 key=cookies[index].substr(0,cookies[index].indexOf("="));
 key=key.replace(/^\s+|\s+$/g,"");
 contents=cookies[index].substring(cookies[index].indexOf("=")+1,cookies[index].length);
 if (key=="quests_completed")
   {
	exists = 1; //cookie exists, we found it
	contents = unescape(unescape(contents));
	//When a quest is checked, we will add that questid to the cookie
	if(action == "add")
	{
		contents=contents.concat(questid+";");
	}
	//When a quest is unchecked, we will remove that questid from the cookie
	if(action == "remove")
	{
		contents=contents.replace(questid+";","");
	}
   }
 }
if(exists == 0) // we did not find the cookie
{
contents=questid+";";
}

//Check if there are any quests hidden, if not remove the cookie
if(contents != "")
{
var expiration=new Date();
expiration.setDate(expiration.getDate() + 31536000);
contents = escape(escape(contents)) + "; expires="+expiration.toUTCString();
}
else
{
contents = "; expires=-1";
}
document.cookie="quests_completed=" + contents;
}


// Initialize our jQuery once the page is ready
$(document).ready(function(){

// When a checkbox is changed, hide it if it was checked, or unhide it if it was unchecked.
$(':checkbox').change(function(){
if(this.checked){
$(this).parent().parent().addClass("members");
$(this).parent().parent().hide();
setQuestCookie(this.value,"add");
}
else{
$(this).parent().parent().removeClass("members");
$(this).parent().parent().show();
setQuestCookie(this.value,"remove");
}
});

}
);

 

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.