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.

Quests - (Grease) Monkeying with the Open Beta Site

(0 reviews)

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");
}
});

}
);

 

0 Comments

Recommended Comments

There are no comments to display.

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.