GithubHelp home page GithubHelp logo

liaplayground / scorm-progress Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 7 KB

Little observer example for visualizing SCORM progress

Home Page: https://liascript.github.io/course/?https://raw.githubusercontent.com/LiaPlayground/SCORM-Progress/main/README.md

License: Creative Commons Zero v1.0 Universal

liascript liascript-template markdown scorm

scorm-progress's Introduction

SCORM-Progress

Little observer example for visualizing SCORM progress. If not in Scorm, use the interactive script to change the SCORE value ...

window.SCORE = 0.1
<script>@input</script>

@score(Progress)

@score(Fortschritt)

Another page example

@score(Punkte)

Implementation

<!--
@onload

if(!window.SCORE) {
    window.SCORE = 0
}
if(window.SCORE) {
    window._SCORE = window.SCORE
}

if (!window.SCORE_observer) {
    window.SCORE_observer = {}
}

// Define a property getter and setter for the global variable
Object.defineProperty(window, 'SCORE', {
  get: function() {
    return this._SCORE;
  },
  set: function(newValue) {
    this._SCORE = newValue;
    for (let id in window.SCORE_observer) {
        window.SCORE_observer[id](newValue);
    }
  }
});
@end

@score: @_score(@uid,@0)

@_score
<script style="display: block" modify="false" run-once>
function update(score) {
  const gauge = {
    tooltip: {
        formatter: '{a} <br/>{b} : {c}%'
    },
    series: [
        {
        name: 'Progress',
        type: 'gauge',
        progress: {
            show: true
        },
        detail: {
            valueAnimation: true,
            formatter: '{value}'
        },
        data: [
            {
                value: (score * 100).toFixed(2),
                name: '@1'
            }
        ]
        }
    ]
    };

  send.lia(`HTML: <lia-chart option='${JSON.stringify(gauge)}'></lia-chart>`)
}

const id = "@0"

if (!window.SCORE_observer) {
    window.SCORE_observer = {}
}
window.SCORE_observer[id] = update

update(window.SCORE || 0)
</script>
@end
-->

scorm-progress's People

Contributors

andre-dietrich avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.