File size: 3,833 Bytes
7f8b26c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Dictionary of categories and their corresponding links
CATEGORIES = {
    "AFFORDABLE HOUSING AND HOMELESSNESS": """
- National Low Income Housing Coalition: [Visit Site](https://nlihc.org)
- National Alliance to End Homelessness: [Visit Site](https://endhomelessness.org)
- National Coalition for the Homeless: [Visit Site](https://nationalhomeless.org)
- Department of Housing and Urban Development: [Visit Site](https://portal.hud.gov/hudportal/HUD)
""",
    "AGING": """
- Administration on Aging/Data Resources: [Visit Site](https://aoa.acl.gov/Aging_Statistics/index.asp)
""",
    "ARTS": """
- The Research Center for Arts and Culture: [Visit Site](https://artsandcultureresearch.org)
- Americans for the Arts: [Visit Site](https://americansforthearts.org)
""",
    "CHILDREN AND POVERTY": """
- National Center for Children in Poverty: [Visit Site](https://nccp.org)
- Children’s Defense Fund: [Visit Site](https://childrensdefense.org)
- Save the Children: [Visit Site](https://savethechildren.org)
""",
    "EDUCATION": """
- National Center for Education Statistics: [Visit Site](https://nces.ed.gov)
""",
    "ENERGY ASSISTANCE": """
- Low Income Energy Assistance Program: [Visit Site](https://acf.hhs.gov/programs/ocs/liheap)
""",
    "ENVIRONMENT": """
- Stanford Geospacial Center (GIS data online): [Visit Site](https://library.stanford.edu/research/stanford-geospatial-center/data)
- Environmental Protection Agency: [Visit Site](https://epa.gov)
""",
    "HEALTH": """
- Center for Disease Control: [Visit Site](https://cdc.gov)
- State Public Health Data/Trust for America’s Health: [Visit Site](https://healthyamericans.org/states)
""",
    "HUNGER": """
- Crop Walk: [Visit Site](https://crophungerwalk.org)
- Bread for the World: [Visit Site](https://bread.org)
""",
    "INTERNATIONAL": """
- United Nations Statistics Division: [Visit Site](https://unstats.un.org/unsd/databases.htm)
""",
    "LIVING WAGE": """
- The Living Wage Resource Center: [Visit Site](https://livingwagecampaign.org)
- Economic Policy Institute: [Visit Site](https://epi.org)
- Bureau of Labor Statistics: [Visit Site](https://bls.gov)
""",
    "POVERTY": """
- U.S. Department of Health and Human Services Poverty Guidelines: [Visit Site](https://aspe.hhs.gov/poverty)
- Center of Urban Poverty: [Visit Site](https://povertycenter.case.edu)
- National Poverty Center: [Visit Site](https://npc.umich.edu)
""",
    "UNITED STATES": """
- IssueLab: [Visit Site](https://issuelab.org)
- US Census: [Visit Site](https://census.gov)
- FedStats: [Visit Site](https://fedstats.sites.usa.gov)
- The Urban Institute: [Visit Site](https://urban.org)
""",
    "YOUTH": """
- Youth Risk Behavioral Survey: [Visit Site](https://cdc.gov/Features/YRBS)
"""
}

# Editorial ai css
CSS = """
.custom-textarea {
    width: 100%;
    height: 300px;
    border: 1px solid #ccc;
    padding: 10px;
    font-size: 16px;
    line-height: 1.5;
}

mark {
    background-color: #ffcccc;  /* Faded red */
}
"""


# Editorial ai js
JS = """
document.addEventListener('DOMContentLoaded', function() {
    // Listen for changes in the textarea
    let textarea = document.getElementById('highlighted_textarea');
    textarea.addEventListener('input', function() {
        // Reapply the highlighting (simple implementation)
        let content = textarea.innerText;
        let highlightedContent = content;
        for (let highlightText of window.highlightTexts) {
            highlightedContent = highlightedContent.replace(
                new RegExp(escapeRegExp(highlightText), 'g'),
                `<mark>${highlightText}</mark>`
            );
        }
        textarea.innerHTML = highlightedContent;
    });
});

function escapeRegExp(string) {
    return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
"""