Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>Keyword Filter Component Demo</title>
- <script src="jquery-3.4.0.min.js"></script>
- <!-- The following css file would be provided -->
- <link rel="stylesheet" href="keyword-filter-component.css" />
- <!-- The following js file would be provided -->
- <script src="keyword-filter-component.js"></script>
- </head>
- <body>
- <div id="keyword-filter-component-div" style="position:fixed;top:0;right:0;bottom:0;width:300px;">
- <!--
- This div becomes the keyword filter component.
- Its position MUST be fixed/absolute/relative,
- and it should be located wherever you want
- the component to be and its width and heigth
- should be set accordingly.
- -->
- </div>
- <script>
- // Create the component and provide the necessary callbacks.
- var keywordFilterComponent = $('#keyword-filter-component-div').keywordFilterComponent({
- convertSecondsToPageTimeDisplay: null, // Optional; if not provided, we would use our own method that we implemented.
- callbacks: {
- collapseWordList: function(collapse) {
- // Perhaps send the `collapse` value to your back-end server...
- },
- activateKeywordListSort: function(key) {
- // Perhaps send the `key` value to your back-end server...
- },
- activateKeywordListDisplay: function(key) {
- // Perhaps send the `key` value to your back-end server...
- },
- activateKeywordSelection: function(activated, word) {
- // Perhaps send the `activated` value and `word` JSON object to your back-end server...
- },
- activateKeywordColorSelection: function(activated, word) {
- // Perhaps send the `activated` value and `word` JSON object to your back-end server...
- },
- configureKeywordColor: function(word, color) {
- // Perhaps send the `word` and `color` JSON objects to your back-end server...
- },
- onWordTimestampClick: function(word, timestamp) {
- // Perhaps send the `word` and `timestamp` JSON objects to your back-end server...
- },
- collapseFilterList: function(collapse) {
- // Perhaps send the `collapse` value to your back-end server...
- },
- activateKeywordFilterView: function(activated) {
- // Perhaps send the `activated` value to your back-end server...
- },
- activateKeywordFilter: function(activated, filter) {
- // Perhaps send the `activated` value and `filter` JSON object to your back-end server...
- },
- configureKeywordFilterName: function(filter, name) {
- // Perhaps send the `filter` JSON object and `name` value to your back-end server...
- },
- adjustKeywordFilterKeywordList: function(added, filter, word) {
- // Perhaps send the `added` value and `filter` and `word` JSON objects to your back-end server...
- }
- }
- });
- // Dummy data retriever methods (for demonstration purposes):
- function getKeywordList() {
- return {
- "WordList": [
- {
- "Id": 1,
- "Count": 1,
- "Content": "so",
- "Selected": false,
- "Color": "#c3c3c3",
- "Occurrences": [
- {
- "SecondsStart": 7,
- "SecondsEnd": 10
- }
- ]
- }
- ]
- };
- };
- function getKeywordListActiveColors() {
- return {
- "AvailableColors": [
- {
- "Id": 1,
- "Name": "PINK",
- "HexValue": "#FFC0CB"
- }
- ]
- };
- };
- function getAvailableFilters() {
- return {
- "Filter": [
- {
- "FilterName": "Technology",
- "FilterId": 1,
- "Active": true,
- "words": [
- {
- "Content": "Computational",
- "Id": 2
- },
- {
- "Content": "Implemntation",
- "Id": 3
- }
- ]
- }
- ]
- };
- };
- function getConfiguration() {
- return {
- "KeywordListConfiguration": {
- "KeywordListDisplayType" : "All",
- "KeywordListSortType" : "Alphabetical",
- "KeywordListViewCollapse": false,
- "KeywordFilterViewCollapse": true
- }
- };
- };
- // Call the components methods.
- keywordFilterComponent.keywordFilterMethods.loadKeywordList(getKeywordList());
- keywordFilterComponent.keywordFilterMethods.loadKeywordListActiveColors(getKeywordListActiveColors());
- keywordFilterComponent.keywordFilterMethods.loadKeywordListFilters(getAvailableFilters());
- keywordFilterComponent.keywordFilterMethods.loadKeywordListConfiguration(getConfiguration());
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement