PageSourceSearch

https://libcinder.org/static/scripts/libcinder.js

js libcinder.org collected 2026-10-01 10:34:39 UTC 4,224 bytes, 155 lines download raw bytes

1/*
2$( function() {
3    var cinderApp = ( function () {
4        var $homepage = $('.homepage'),
5            $jumbotron = $('.jumbotron'),
6            backgroundNumber = 5,
7            projectArray = [
8                'CinderISO Metaball study',
9                '“Leap of Faith” for World Economic Forum',
10                'Boil Up',
11                'Boil Up',
12                'Mill Touch'
13            ];
14
15        function randomBackground() {
16            var random = Math.floor(Math.random() * ( 1 + backgroundNumber - 1 ) ) + 1 ;
17            $homepage.find($jumbotron).css('background-image', 'url(static/images/homepage/Hero' + random + '.jpg)');
18            $('.project-name').text(projectArray[random -1]);
19        }
20
21        function init() {
22            randomBackground();
23        }
24
25        return {
26            init: init
27        };
28    })();
29
30    cinderApp.init();
31});
32
33
34$( document ).ready( function() {
35    var ci = function() { 
36
37        return {
38
39        }
40    }();
41
42    ci.init()
43} )
44*/
45
46function ProjectForm( max_contributors, max_images ) 
47{
48    var that = this
49
50    /* MANAGES visibility of add/reset links across form */
51    this.refresh = function() {
52
53        // CONTRIBUTOR resets
54        var contributor_resets = $( ".remove-contributor" )
55        contributor_resets.each( function() { 
56            $( this ).click( function( event ) { 
57                event.preventDefault()
58
59                $( this ).closest( ".contributor" ).remove()
60                that.refresh()
61            } )
62
63            $( this ).hide()
64        } )
65
66        // SHOW last reset button
67        if( contributor_resets.length > 1 ) {
68            contributor_resets.last().show()
69        }
70
71        // SHOW add contributor button
72        if( contributor_resets.length < MAX_CONTRIBUTORS ) {
73            $( "#add-contributor" ).show()
74        }
75
76        // IMAGE resets
77        var image_resets = $( ".remove-image" )
78        image_resets.each( function() { 
79            $( this ).click( function( event ) { 
80                event.preventDefault()
81
82                $( this ).closest( ".image" ).remove()
83                that.refresh()
84            } )
85
86            $( this ).hide()
87        } )
88
89        // SHOW last reset button
90        if( image_resets.length > 1 ) {
91            image_resets.last().show()
92        }
93
94        // SHOW add image button
95        if( image_resets.length < MAX_IMAGES ) {
96            $( "#add-image" ).show()
97        }
98    }
99
100    $( "#add-contributor" ).click( function( event ) { 
101        event.preventDefault();
102
103        // DISABLE add link if max contributors exceeded
104        var contributors = $( "#contributors .contributor" )
105        if( contributors.length + 1 >= MAX_CONTRIBUTORS ) {
106            $( this ).hide()
107        }
108
109        // COPY form elements
110        var contributor = contributors.last().clone();
111
112        // REMOVE all label tags
113        contributor.find( "label" ).remove()
114
115        // INCREMENT field index & CLEAR value
116        contributor.find( "input" ).each( function() {
117            var parts = $( this ).attr( "name" ).split( "-" )
118            var next_index = parseInt( parts[1] ) + 1
119            $( this ).attr( "name", parts[0] + "-" + next_index + "-" + parts[2] )
120            $( this ).val( "" )
121        } )
122
123        // ADD fields to container
124        $( "#contributors" ).append( contributor )
125        that.refresh()
126    } )
127
128    $( "#add-image" ).click( function( event ) { 
129        event.preventDefault();
130
131        // DISABLE add link if max images exceeded
132        var images = $( "#images .image" )
133        if( images.length + 1 >= MAX_IMAGES ) {
134            $( this ).hide()
135        }
136
137        // COPY form elements
138        var image = images.last().clone();
139
140        // REMOVE all label tags
141        image.find( "label" ).remove()
142
143        // INCREMENT field index & CLEAR value
144        image.find( "input" ).each( function() {
145            var parts = $( this ).attr( "name" ).split( "-" )
146            var next_index = parseInt( parts[1] ) + 1
147            $( this ).attr( "name", parts[0] + "-" + next_index )
148            $( this ).val( "" )
149        } )
150
151        // ADD form to images
152        $( "#images" ).append( image )
153        that.refresh()
154    } )
155}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.