Jump to content

Search the Community

Showing results for tags 'fdp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Support
    • Support
    • Common Questions
  • General
    • The Frog Academy
    • General chat
    • Showcase
    • Webinars
  • Technical Forums (How do I...?)
    • Learn / Play / Progress
    • Coding

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


School

Found 1 result

  1. I thought I'd share this snippet more for reference than for a specific need, but it saves you have to work it out later. It uses an FDP API (fixed so they will not be changed, unlike the internal APIs) This is example, it was needed to change the site's background and banner to match a student's house colours. I know I could have set the CSS in Javascript, but pages load on demand and by rendering out the CSS, it is easy to adapt for all sites, or all pages etc... <div class="styling"></div> <script> var siteUUID = 'SITE_UUID', user = FrogOS ? FrogOS.getUser() : this.getUser(), styling = arguments[0].find('.styling'); houseColours = { 'House1': { background: 'rgba(0,255,0,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' }, 'House2': { background: 'rgba(255,0,0,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' }, 'House3': { background: 'rgba(255,255,0,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' }, 'House4': { background: 'rgba(0,0,255,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' } }; if (user.profile.type == 'admin' || user.profile.type == 'superuser') { user.uuid = 'STUDENT_UUID'; } FrogOS.fdp({ url: 'group/memberships', path: '/api/fdp/2/', data: { uuid: user.uuid } }).done(function(response) { var house = 'House1'; var groups = response.response; $.each(groups, function(index,group) { if (group.type == 'house') { house = group.name; } }); var background = houseColours[house].background, banner = houseColours[house].banner; styling.html( '<style>'+ 'div[data-site-uuid="'+siteUUID+'"] .ui-theme-mobilesmallbanner-bodyline {'+ 'background: '+background+' !important;'+ 'background: linear-gradient(180deg, '+background+' 0%, rgba(255,255,255,1) 20%) !important;'+ '}'+ 'div[data-site-uuid="'+siteUUID+'"] .ui-theme-mobilesmallbanner-container {'+ 'background-image: url('+banner+') !important;'+ '}'+ '</style>' ) }).fail(function(e) { // Report Error console.log("failed"); }); </script>
×
×
  • Create New...