Unverified Commit a9859f10 authored by Christopher Guindon's avatar Christopher Guindon Committed by GitHub
Browse files

upgrade js codebase (#232)


Signed-off-by: Christopher Guindon's avatarChristopher Guindon <chris.guindon@eclipse-foundation.org>
parent b5e47821
......@@ -3,7 +3,7 @@
!/static/js/
/static/images/vendor/
!/static/images/fake_logo/
/static/js/solstice.js
/static/js/solstice.js*
/exampleSite/public
/exampleSite/layouts/robots.txt
/public
......
{{ if ne .Page.Params.show_featured_footer false }}
<div class="featured-footer" id="featured-footer" data-publish-target="{{ .Page.Params.featured_content_publish_target | default .Site.Params.featured_content_publish_target | default "eclipse_org"}}">
<div class="eclipsefdn-featured-footer featured-footer" id="featured-footer" data-publish-target="{{ .Page.Params.featured_content_publish_target | default .Site.Params.featured_content_publish_target | default "eclipse_org"}}">
<div class="container">
<div class="row">
<div class="col-sm-24 featured-container">
......
{{ if eq .Page.Params.show_featured_story true }}
<div class="featured-story" id="featured-story" data-publish-target="{{ .Page.Params.featured_content_publish_target | default .Site.Params.featured_content_publish_target | default "eclipse_org"}}">
<div class="eclipsefdn-featured-story featured-story" id="featured-story" data-publish-target="{{ .Page.Params.featured_content_publish_target | default .Site.Params.featured_content_publish_target | default "eclipse_org"}}">
<div class="container">
<div class="row">
<div class="col-sm-12 col-sm-offset-2 col-md-16 col-md-offset-0 featured-story-block featured-story-block-content match-height-item-by-row featured-container">
......
......@@ -7,8 +7,6 @@
{{- with .Site.Params.hugo_js }}
<script src="{{ . | relURL }}"></script>
{{ end }}
{{ else }}
<script src="{{ "/js/solstice.hugo.js" | relURL }}"></script>
{{ end }}
<!-- Read in mustache templates registered in page scratch -->
......@@ -31,15 +29,5 @@
type: "newsItems"
});
{{ end }}
{{ if ne .Page.Params.show_featured_story false }}
$("{{ .Site.Params.featured_footer_selector | default "#featured-story" }}").eclipseFdnApi({
type: "featuredStory"
});
{{ end }}
{{ if ne .Page.Params.show_featured_footer false }}
$("{{ .Site.Params.featured_footer_selector | default "#featured-footer" }}").eclipseFdnApi({
type: "featuredFooter"
});
{{ end }}
})(jQuery, document);
</script>
\ No newline at end of file
<!--
<!--
Copyright (c) 2019 Eclipse Foundation, Inc.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
Contributors:
Christopher Guindon <chris.guindon@eclipse-foundation.org>
SPDX-License-Identifier: EPL-2.0
-->
-->
{{ $container_id := .Get "container_id" | default "" }}
{{ $class := .Get "class" | default "eclipsefdn-adopters" }}
{{ $working_group := .Get "working_group" | default "" }}
{{ $ul_classes := .Get "ul_classes" | default "text-center list-inline" }}
<div id="{{ $container_id }}" class="{{ $class }}"></div>
<script src="{{ "js/eclipsefdn.adopters.js" | relURL}}"></script>
<script>
eclipseFdnAdopters.getWGList({src_root: "https://api.eclipse.org/adopters", working_group: "{{ $working_group }}", ul_classes: "{{ $ul_classes }}"})
</script>
This diff is collapsed.
......@@ -24,7 +24,7 @@
"readmeFilename": "README.md",
"dependencies": {
"axios": "^0.21.1",
"eclipsefdn-solstice-assets": "0.0.156",
"eclipsefdn-solstice-assets": "0.0.160",
"json2yaml": "^1.1.0",
"parse-link-header": "^1.0.1",
"toml": "^3.0.0"
......
"use strict";function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var EclipseFdnAdopters=function(){function e(){_classCallCheck(this,e),_defineProperty(this,"precompiledRegex",/<([^>]*?)>;(\s?[\w-]*?="(?:\\"|[^"])*";){0,}\s?rel="next"/),_defineProperty(this,"default_options",{project_id:"",selector:".eclipsefdn-adopters",ul_classes:"",logo_white:!1,working_group:"",src_root:"https://api.eclipse.org/adopters",src_projects_prefix:"/projects"}),_defineProperty(this,"getList",(function(e){var t=this,r=this.getMergedOptions(e);this.fireCall(r,(function(e){t.createProjectList(e,r,document.querySelectorAll(r.selector)),t.scrollToAnchor()}))})),_defineProperty(this,"getWGList",(function(e){var t=this,r=this.getMergedOptions(e);this.fireCall(r,(function(e){t.createWGProjectsList(e,r,document.querySelectorAll(r.selector)),t.scrollToAnchor()}))}))}return _createClass(e,[{key:"getMergedOptions",value:function(e){var t=JSON.parse(JSON.stringify(this.default_options));if(void 0!==e&&"object"===_typeof(e))for(var r in this.default_options)void 0===e[r]||"string"!=typeof e[r]&&"boolean"!=typeof e[r]||(t[r]=e[r]);return t}},{key:"fireCall",value:function(e,t){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=this,i=new XMLHttpRequest;i.onreadystatechange=function(){if(4==this.readyState&&200==this.status){var r=JSON.parse(this.responseText);(Array.isArray(o)||o.length)&&(r=o.concat(r));var a=i.getResponseHeader("Link");if(null!==a){var l=a.match(n.precompiledRegex);null!==l?(e.next=l[1],n.fireCall(e,t,r)):t(r)}else t(r)}else 4==this.readyState&&console.log("Error while retrieving adopters data, could not complete operation")},void 0!==e.next?r=e.next:(r=e.src_root+e.src_projects_prefix,void 0!==e.project_id&&""!==e.project_id.trim()&&(r+="/"+e.project_id),void 0!==e.working_group&&""!==e.working_group.trim()&&(r+="?working_group="+e.working_group)),i.open("GET",r,!0),i.send()}},{key:"createWGProjectsList",value:function(e,t,r){var o,n=_createForOfIteratorHelper(e);try{for(n.s();!(o=n.n()).done;){var i=o.value,a=JSON.parse(JSON.stringify(t));a.project_id=i.project_id;var l=document.createElement("h2");l.textContent=i.name,l.setAttribute("id",i.project_id);for(var s=0;s<r.length;s++)r[s].appendChild(l);var c=document.createElement("a");c.setAttribute("class","btn btn-xs btn-secondary margin-left-10 uppercase"),c.setAttribute("href","https://projects.eclipse.org/projects/"+i.project_id),c.textContent=i.project_id,l.appendChild(c),this.createProjectList(e,a,r)}}catch(e){n.e(e)}finally{n.f()}}},{key:"createProjectList",value:function(e,t,r){var o=document.createElement("ul");if(void 0!==e){var n,i=_createForOfIteratorHelper(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(t.project_id===a.project_id){var l,s=_createForOfIteratorHelper(a.adopters);try{for(s.s();!(l=s.n()).done;){var c=l.value,p="";void 0!==c.homepage_url&&(p=c.homepage_url);var u="";void 0!==c.name&&(u=c.name);var f="";void 0!==c.logo&&(f=c.logo),!0===t.logo_white&&void 0!==c.logo_white&&(f=c.logo_white);var d=document.createElement("li"),y=document.createElement("a"),h=document.createElement("img");y.setAttribute("href",p),h.setAttribute("alt",u),h.setAttribute("src",t.src_root+"/assets/images/adopters/"+f),h.setAttribute("class","adopters-img"),y.appendChild(h),d.appendChild(y),o.appendChild(d)}}catch(e){s.e(e)}finally{s.f()}}}}catch(e){i.e(e)}finally{i.f()}}for(var _=0;_<r.length;_++)""!==t.ul_classes&&o.setAttribute("class",t.ul_classes),r[_].appendChild(o)}},{key:"scrollToAnchor",value:function(){if(location.hash){var e=location.hash.replace("#","");document.getElementById("".concat(e)).scrollIntoView()}}}]),e}(),eclipseFdnAdopters=new EclipseFdnAdopters;
!function(s,a){"undefined"!=typeof tableClasses&&null!=tableClasses&&s(a).ready((function(){s("main table").each((function(a){null==s(this).attr("class")&&s(this).addClass(tableClasses)}))}))}(jQuery,document);
let mix = require('laravel-mix');
require('laravel-mix-transpile-node-modules')
mix.transpileNodeModules(['eclipsefdn-solstice-assets']);
mix.options({uglify: {uglifyOptions: {compress: false, output: {comments: true}}}});
mix.setPublicPath('static');
......@@ -6,25 +10,12 @@ mix.setResourceRoot('../');
mix.less('./node_modules/eclipsefdn-solstice-assets/less/quicksilver/styles.less', 'static/css/styles.css');
mix.babel([
'./node_modules/eclipsefdn-solstice-assets/js/eclipsefdn.adopters.js'
], './static/js/eclipsefdn.adopters.js');
mix.scripts([
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/bootstrap/dist/js/bootstrap.min.js',
'./node_modules/cookieconsent/src/cookieconsent.js',
'./node_modules/eclipsefdn-solstice-assets/js/solstice.cookieconsent.js',
'./node_modules/eclipsefdn-solstice-assets/js/eclipsefdn.videos.js',
'./node_modules/jquery-match-height/dist/jquery.matchHeight-min.js',
'./node_modules/jquery-eclipsefdn-api/dist/jquery.eclipsefdn-api.min.js',
'./node_modules/feather-icons/dist/feather.min.js',
'./node_modules/owl.carousel/dist/owl.carousel.min.js',
'./node_modules/eclipsefdn-solstice-assets/js/solstice.cookies.js',
'./node_modules/eclipsefdn-solstice-assets/js/solstice.js',
'./node_modules/eclipsefdn-solstice-assets/js/solstice.eventsmodal.js'
], './static/js/solstice.js');
mix.webpackConfig({
resolve: {
alias: {
jquery: 'jquery/src/jquery',
},
},
});
mix.scripts([
'./node_modules/eclipsefdn-solstice-assets/js/solstice.tables.js'
], './static/js/solstice.hugo.js');
\ No newline at end of file
mix.js(['./node_modules/eclipsefdn-solstice-assets/js/main.js'], './static/js/solstice.js');
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment