2024-07-12 22:19:12 -04:00
// core and prism
2024-07-13 10:16:32 -04:00
import * as core from './core/_core.js' ;
2024-06-13 00:00:00 -04:00
import * as Prism from "../../node_modules/prismjs/prism" ;
import '../../node_modules/prismjs/components/prism-json' ;
import '../../node_modules/prismjs/components/prism-pug' ;
2024-07-11 21:05:34 -04:00
import '../../node_modules/prismjs/components/prism-sass' ;
2024-06-13 00:00:00 -04:00
import "../../node_modules/prismjs/plugins/toolbar/prism-toolbar" ;
import "../../node_modules/prismjs/plugins/line-numbers/prism-line-numbers" ;
2024-07-12 22:19:12 -04:00
// import pattern stuff.
2024-07-13 10:16:32 -04:00
import * as swtch from "../pg/patterns/core/components/switch/_switch.js" ;
import * as stickynote from "../pg/patterns/core/components/sticky-note/_sticky-note.js" ;
import * as tabs from "../pg/patterns/core/layouts/tabs/_tabs.js" ;
2024-06-13 00:00:00 -04:00
2024-07-12 22:19:12 -04:00
// init core
core . init ( {
success : ( a ) => {
tabs . init ( a ) ;
swtch . init ( a ) ;
stickynote . init ( a ) ;
} ,
notFound : ( a , path ) => {
a . innerHTML = ` ${ a . innerHTML } <div class='notification-box error'><p>This pattern appears to be missing.<br><small>( ${ path } returned http status 404)</small></p></div> ` ;
}
} ) ;
2024-06-13 00:00:00 -04:00
jQuery ( document ) . ready ( function ( $ ) {
// show deprecated switch
function flipDeprecated ( ) {
setTimeout ( function ( ) {
if ( $ ( "#deprecated" ) . attr ( "aria-checked" ) == "false" ) {
$ ( ".status-deprecated" ) . closest ( "article" ) . addClass ( "status-deprecated" ) ;
2024-07-12 22:19:12 -04:00
core . cookie . set ( "show-deprecated" , false , 30 , "/" ) ;
2024-06-13 00:00:00 -04:00
} else {
$ ( "article.status-deprecated" ) . removeClass ( "status-deprecated" ) ;
2024-07-12 22:19:12 -04:00
core . cookie . set ( "show-deprecated" , true , 30 , "/" ) ;
2024-06-13 00:00:00 -04:00
}
} , 50 ) ;
}
$ ( "#deprecated" ) . on ( "click" , flipDeprecated ) . on ( "keypress" , flipDeprecated ) ;
setTimeout ( function ( ) {
2024-07-12 22:19:12 -04:00
if ( core . cookie . get ( "show-deprecated" ) == "true" ) {
2024-06-13 00:00:00 -04:00
$ ( "#deprecated" ) . attr ( "aria-checked" , "true" ) ;
flipDeprecated ( ) ;
}
} , 200 ) ;
2024-07-12 22:19:12 -04:00
console . log ( "hide deprecated" , { "type" : ( typeof core . cookie . get ( "show-deprecated" ) ) , "value" : core . cookie . get ( "show-deprecated" ) } ) ;
2024-06-13 00:00:00 -04:00
// /hide deprecated switch
2024-07-11 21:05:34 -04:00
} )
2024-07-12 22:19:12 -04:00
// import("../pg/patterns/layouts/main-navigation/_main-navigation.js");