Skip to content

Instantly share code, notes, and snippets.

@Rohaq
Created August 31, 2010 02:14
Show Gist options
  • Select an option

  • Save Rohaq/558423 to your computer and use it in GitHub Desktop.

Select an option

Save Rohaq/558423 to your computer and use it in GitHub Desktop.

Revisions

  1. Rohaq created this gist Aug 31, 2010.
    40 changes: 40 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    SALR.prototype.notifyUserAccessResult = function(result) {
    this.Platinum = result.Platinum;
    this.Archives = result.Archives;
    this.NoAds = result.NoAds;

    alert(this.Platinum);
    };

    SALR.prototype.getUserAccess = function() {
    var Platinum = '';
    var Archives = '';
    var NoAds = '';
    var that = this;
    jQuery.get('/member.php?action=accountfeatures', function(data){
    var PlatRegex = new RegExp('<dt class="(.+?)">Platinum Upgrade</dt>',["i"]);
    var PlatMatches = PlatRegex.exec(data);
    if ( PlatMatches != null ) {
    // alert("Platinum: " + PlatMatches[1]);
    Platinum = PlatMatches[1];
    }
    var ArchRegex = new RegExp('<dt class="(.+?)">Archives Upgrade</dt>',["i"]);
    var ArchMatches = ArchRegex.exec(data);
    if ( ArchMatches != null ) {
    // alert("Archives: " + ArchMatches[1]);
    Archives = ArchMatches[1];
    }
    var NoAdsRegex = new RegExp('<dt class="(.+?)">No-Ads Upgrade</dt>',["i"]);
    var NoAdsMatches = NoAdsRegex.exec(data);
    if ( NoAdsMatches != null ) {
    // alert("No-Ads: " + NoAdsMatches[1]);
    NoAds = NoAdsMatches[1];
    }

    that.notifyUserAccessResult({
    Platinum:Platinum,
    Archives:Archives,
    NoAds:NoAds
    });
    });
    }